/* Landing screen and shared How-to presentation ------------------- */
body.hero-open {
  overflow: hidden;
  background: #070a0f;
}

body.hero-open .app {
  width: 100%;
  height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body.hero-open .topbar {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-12px);
}

.hero-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  background: #070a0f;
  transition: opacity .38s ease, visibility .38s ease;
}

.hero-screen::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  opacity: .18;
  pointer-events: none;
  background-image:
    linear-gradient(#ffffff0a 1px, transparent 1px),
    linear-gradient(90deg, #ffffff0a 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(90deg, #000 0, transparent 78%);
}

.hero-screen.is-exiting {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.hero-art {
  display: none;
}

.hero-art::before {
  display: none;
  content: "";
  position: absolute;
  right: -2vw;
  bottom: -8vh;
  width: min(58vw, 1060px);
  aspect-ratio: 1;
  border: 1px solid #ffffff10;
  border-radius: 50%;
  background: radial-gradient(circle, #3d61734f 0, #1f334130 45%, transparent 70%);
  box-shadow: inset 0 0 90px #8bd9ff0b;
}

.hero-operator {
  position: absolute;
  right: clamp(-100px, -1vw, 10px);
  bottom: clamp(-90px, -5vh, -32px);
  width: min(52vw, 940px);
  height: min(92dvh, 1010px);
  object-fit: contain;
  object-position: right bottom;
  filter: drop-shadow(-35px 28px 45px #000000b8) saturate(.88) contrast(1.04);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 28%, #000 100%);
  mask-image: linear-gradient(90deg, transparent 0%, #000 28%, #000 100%);
}

.hero-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, #070a0f 0%, #070a0ff2 33%, #070a0f8f 54%, transparent 78%),
    linear-gradient(0deg, #070a0fc7 0%, transparent 31%),
    linear-gradient(180deg, #070a0f7a 0%, transparent 19%);
}

.hero-content {
  position: relative;
  z-index: 2;
  width: min(1420px, calc(100% - 32px));
  height: 100dvh;
  min-height: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(12px, 2vh, 20px);
  margin: 0 auto;
  padding: clamp(30px, 5vh, 62px) 0 clamp(44px, 7vh, 86px);
}

.hero-logo {
  width: clamp(160px, 15vw, 250px);
  height: auto;
  flex: 0 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 10px 27px #000d);
}

.hero-howto-slot {
  width: 100%;
  display: flex;
  justify-content: center;
  padding-top: clamp(12px, 2vh, 20px);
  border-top: 1px solid #ffffff24;
}

.rules-panel {
  --rules-surface: #070a0f;
  position: relative;
  width: 100%;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  color: var(--text);
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.rules-panel-head {
  display: grid;
  justify-items: center;
  gap: 9px;
  padding: 20px 24px 18px;
  text-align: center;
}

.rules-panel-head h1 {
  margin: 0;
  font-family: "Oswald", "Barlow Condensed", "Arial Narrow", sans-serif;
  font-size: clamp(2.25rem, 4vw, 3.4rem);
  font-weight: 650;
  letter-spacing: -.035em;
  line-height: 1;
}

.rules-intro-copy {
  width: min(1120px, 100%);
  display: grid;
  justify-self: center;
  gap: 12px;
}

.rules-intro-copy p {
  margin: 0;
  color: var(--muted);
  font-size: clamp(1.12rem, 1.45vw, 1.35rem);
  font-weight: 750;
  line-height: 1.5;
}

.rules-intro-copy strong { color: var(--text); }

.rules-intro-copy .rules-example-lead {
  position: relative;
  display: inline-block;
  margin-right: .18em;
  color: #f04f5f;
}

.rules-intro-copy .rules-example-lead::after {
  position: absolute;
  right: 0;
  bottom: -.16em;
  left: 0;
  height: 1px;
  background: #f04f5f;
  content: "";
}

.rules-panel .rules-body {
  display: grid;
  gap: 14px;
  padding: 18px 20px 20px;
  background: var(--rules-surface);
}

.rules-panel .rules-example {
  --rules-example-padding: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  justify-items: center;
  gap: 14px;
  padding: 14px;
  overflow: hidden;
  border: 0;
  border-radius: 6px;
  background: var(--rules-surface);
}

.rules-player-example {
  position: relative;
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) 72px;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: var(--rules-surface);
  box-shadow: none;
}

.rules-pov-example {
  position: relative;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--rules-surface);
}

#rulesAudioPoster {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
}

.rules-audio-shade {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 38%, #020407a8);
}

.rules-target-card {
  position: absolute;
  bottom: 9px;
  left: 9px;
  z-index: 3;
  width: min(320px, calc(100% - 18px));
  height: 120px;
  overflow: hidden;
  border: 1px solid var(--white-line-strong);
  border-radius: 3px;
  background: #0b0f16f5;
  box-shadow: 0 12px 30px #0000008f;
  backdrop-filter: blur(10px);
  container-type: inline-size;
}

.rules-target-label {
  position: absolute;
  top: 10px;
  left: 12px;
  z-index: 1;
  color: #fff;
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.rules-target-card .guess-operator {
  width: 100%;
  height: 100%;
  grid-template-columns: 82px minmax(0, 1fr);
  column-gap: 13px;
  padding: 28px 12px 8px;
}

.rules-target-card .guess-operator-icon {
  width: 82px;
  height: 82px;
  transform: scale(1.12);
  transform-origin: center;
}

.rules-target-card .guess-operator-copy b {
  color: var(--text);
  font-size: 1.82rem;
  letter-spacing: -.045em;
}

.rules-target-card .guess-operator-stat > span {
  font-size: .64rem;
}

.rules-target-card .guess-operator-dots i {
  width: 9px;
  height: 9px;
}

.rules-audio-controls {
  width: 100%;
  min-height: 72px;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 12px;
  padding: 8px 12px 8px 15px;
  border: 0;
  border-radius: 0 0 5px 5px;
  background: var(--rules-surface);
  backdrop-filter: blur(11px);
  container-type: inline-size;
}

.rules-audio-controls .audio-primary-cluster,
.rules-audio-controls .audio-total,
.rules-audio-controls .audio-secondary-controls {
  flex: 0 0 auto;
}

.rules-audio-controls .audio-waveform-main {
  flex: 1 1 150px;
  height: 54px;
}

.rules-audio-controls .audio-primary {
  min-height: 42px;
  gap: 9px;
  font-size: 1.16rem;
}

.rules-audio-controls .audio-primary img {
  width: 21px;
  height: 21px;
}

.rules-audio-controls .audio-elapsed,
.rules-audio-controls .audio-total {
  font-size: .78rem;
}

.rules-audio-controls .audio-secondary-controls {
  gap: 5px;
}

.rules-audio-controls .audio-secondary-controls .iconbtn {
  width: 36px;
  height: 36px;
}

.rules-map-example {
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 0;
  align-self: stretch;
  aspect-ratio: auto;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: var(--rules-surface);
  box-shadow: none;
}

.rules-map-shell {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--rules-surface);
}

#rulesMapCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.rules-floor-label,
.rules-example-label {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 4;
  padding: 5px 7px;
  border: 0;
  border-radius: 0;
  background: #030508;
  color: #fff;
  font-size: .65rem;
  font-weight: 900;
  letter-spacing: .08em;
}

#rulesAudioVideo {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.round-result-bar.rules-round-result-bar {
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  grid-column: 1 / -1;
  width: auto;
  min-height: 82px;
  margin: 0 calc(-1 * var(--rules-example-padding)) calc(-1 * var(--rules-example-padding));
  padding-block: 12px;
  border-top: 0;
  border-radius: 0 0 5px 5px;
  background: var(--rules-surface);
  box-shadow: none;
  backdrop-filter: none;
  opacity: 1;
  transform: none;
}

.round-result-bar.rules-round-result-bar .round-result-distance strong,
.round-result-bar.rules-round-result-bar .round-result-points strong {
  font-size: clamp(2rem, 3vw, 2.8rem);
}

.round-result-bar.rules-round-result-bar .round-next {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-transform: none;
}

.hero-play:disabled {
  opacity: .56;
  cursor: wait;
}

.hero-play:hover:not(:disabled) {
  transform: translateY(-1px);
}

dialog.rules-dialog {
  width: min(1420px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  overflow: auto;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--text);
  background: #070a0f;
  box-shadow: 0 30px 100px var(--overlay);
}

dialog.rules-dialog::backdrop {
  background: #020407d9;
  backdrop-filter: blur(7px);
}

.rules-dialog-slot {
  padding: 18px;
}

.rules-dialog .rules-panel {
  border: 0;
  background: var(--rules-surface);
  box-shadow: none;
}

.close-rules {
  position: sticky;
  top: 12px;
  z-index: 20;
  float: right;
  margin: 12px 12px -48px 0;
}

/* Keep the complete desktop hero inside shorter, windowed browser viewports. */
@media (min-width: 961px) and (max-height: 1000px) {
  .hero-screen {
    overflow: hidden;
  }

  .hero-content {
    gap: 18px;
    justify-content: center;
    height: 100dvh;
    min-height: 0;
    padding: 18px 0;
  }

  .hero-logo {
    width: clamp(160px, 13vw, 220px);
  }

  .rules-panel-head {
    gap: 4px;
    padding: 12px 20px 10px;
  }

  .rules-panel-head h1 {
    font-size: clamp(1.85rem, 3.1vw, 2.55rem);
  }

  .rules-intro-copy p {
    font-size: 1.05rem;
  }

  .rules-panel .rules-body {
    gap: 9px;
    padding: 10px 16px 12px;
  }

  .rules-panel .rules-example {
    --rules-example-padding: 10px;
    gap: 12px;
    padding: 10px;
  }

  .rules-audio-controls {
    min-height: 58px;
  }

  .rules-player-example {
    grid-template-rows: minmax(0, 1fr) 58px;
  }

  .rules-audio-controls .audio-waveform-main {
    height: 40px;
  }

  .rules-map-example {
    min-height: 0;
  }

  .rules-cta {
    min-height: 42px;
  }
}

@media (min-width: 961px) and (max-height: 820px) {
  .hero-content {
    gap: 12px;
    padding: 8px 0;
  }

  .hero-logo {
    width: 180px;
  }

  .rules-panel-head {
    padding-block: 8px 7px;
  }

  .rules-panel-head h1 {
    font-size: 2.1rem;
  }

  .rules-panel .rules-body {
    gap: 7px;
    padding-block: 8px 9px;
  }

  .rules-intro-copy p {
    font-size: 1.08rem;
  }

  .rules-audio-controls {
    min-height: 52px;
    padding-block: 5px;
  }

  .rules-player-example {
    grid-template-rows: minmax(0, 1fr) 52px;
  }

  .rules-audio-controls .audio-waveform-main {
    height: 34px;
  }

  .rules-map-example {
    min-height: 0;
  }

  .rules-cta {
    min-height: 38px;
  }
}

@media (max-width: 960px) {
  .hero-screen {
    overflow-x: hidden;
    overflow-y: auto;
  }

  .hero-content {
    width: min(760px, calc(100% - 32px));
    height: auto;
    min-height: 100dvh;
  }

  .hero-operator {
    right: -24vw;
    width: 86vw;
    opacity: .58;
  }

  .hero-art::after {
    background:
      linear-gradient(90deg, #070a0ff5 0%, #070a0fd3 52%, #070a0f4f 100%),
      linear-gradient(0deg, #070a0fd8 0%, transparent 42%);
  }

  .rules-panel .rules-example {
    grid-template-columns: 1fr;
  }

  .rules-map-example {
    aspect-ratio: 16 / 9;
    min-height: 0;
  }
}

@media (max-width: 620px) {
  .hero-content {
    width: calc(100% - 20px);
    gap: 20px;
    padding: 24px 0 38px;
  }

  .hero-logo {
    width: 170px;
  }

  .hero-operator {
    right: -48vw;
    bottom: 8vh;
    width: 135vw;
    height: 80dvh;
    opacity: .42;
  }

  .rules-panel-head {
    padding: 18px 14px 15px;
  }

  .rules-panel .rules-body {
    gap: 12px;
    padding: 12px;
  }

  .rules-panel .rules-example {
    --rules-example-padding: 9px;
    gap: 10px;
    padding: 9px;
  }

  .rules-map-example {
    min-height: 0;
  }

  .rules-dialog-slot {
    padding: 8px;
  }

  .close-rules {
    top: 7px;
    margin: 7px 7px -43px 0;
  }
}

@media (max-width: 560px) {
  .rules-player-example {
    grid-template-rows: minmax(0, 1fr) 58px;
  }

  .rules-audio-controls {
    min-height: 58px;
    display: grid;
    grid-template-columns: auto minmax(40px, 1fr) auto auto;
    grid-template-rows: 1fr;
    gap: 4px;
    padding: 5px 6px;
  }

  .rules-audio-controls .audio-primary-cluster {
    grid-column: 1;
    grid-row: 1;
    gap: 4px;
  }

  .rules-audio-controls .audio-primary {
    width: 36px;
    min-width: 36px;
    justify-content: center;
    padding: 0;
  }

  .rules-audio-controls .audio-primary span {
    display: none;
  }

  .rules-audio-controls .audio-waveform-main {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    height: 34px;
  }

  .rules-audio-controls .audio-total {
    grid-column: 3;
    grid-row: 1;
  }

  .rules-audio-controls .audio-secondary-controls {
    grid-column: 4;
    grid-row: 1;
    justify-self: end;
    gap: 0;
  }
}

@media (max-width: 390px) {
  .round-result-bar.rules-round-result-bar {
    grid-template-columns: minmax(52px, .8fr) minmax(126px, 1.7fr) minmax(58px, .9fr);
    gap: 5px;
    padding-inline: 6px;
  }

  .round-result-bar.rules-round-result-bar .round-result-distance strong,
  .round-result-bar.rules-round-result-bar .round-result-points strong {
    font-size: 1.55rem;
    white-space: nowrap;
  }

  .round-result-bar.rules-round-result-bar .round-next {
    min-width: 0;
    padding-inline: 7px;
    font-size: .76rem;
    line-height: 1.05;
    white-space: normal;
  }

  .rules-map-example {
    min-height: 0;
  }

  .rules-target-card .guess-operator-copy {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-screen,
  .hero-play {
    transition: none;
  }
}
