@font-face {
  font-family: "Caveat";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("./assets/fonts/caveat-latin-wght-normal.woff2?v=20261016-1")
    format("woff2");
}

#container {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

#container canvas {
  touch-action: none;
}

#scene-transition {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: #000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#mobile-controls[hidden] {
  display: none;
}

#mobile-controls {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  left: max(14px, env(safe-area-inset-left));
  z-index: 11;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  pointer-events: none;
}

.mobile-joystick,
#inspect-button {
  display: grid;
  place-items: center;
  border: 1px solid rgba(242, 238, 231, 0.38);
  background: rgba(8, 13, 29, 0.76);
  color: #f2eee7;
  font: 600 23px/1 sans-serif;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

:root {
  color-scheme: dark;
  --halloween-accent: #f4a340;
  --halloween-bone: #fff1d2;
  --halloween-muted: #d3d8d1;
  --halloween-panel: #111619;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: #080b0d;
  color: var(--halloween-bone);
  font-family: system-ui, sans-serif;
  font-size: 18px;
  line-height: 1.45;
}

button {
  font-family: "Caveat", cursive;
}

.mobile-joystick {
  position: relative;
  width: 132px;
  height: 132px;
  padding: 0;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(244, 163, 64, 0.16) 0 38%,
    rgba(8, 11, 13, 0.82) 39% 100%
  );
  pointer-events: auto;
  margin-left: 20px;
}

.mobile-joystick:active,
#inspect-button:active {
  background-color: var(--halloween-accent);
  color: #1b1208;
}

.joystick-stick {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 56px;
  height: 56px;
  border: 1px solid rgba(255, 241, 210, 0.72);
  border-radius: 50%;
  background: var(--halloween-accent);
  box-shadow: 0 2px 9px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  transform: translate(
    calc(-50% + var(--stick-x, 0px)),
    calc(-50% + var(--stick-y, 0px))
  );
}

#inspect-button {
  width: 92px;
  height: 92px;
  border-color: rgba(244, 163, 64, 0.8);
  border-radius: 50%;
  background: rgba(38, 27, 15, 0.92);
  font-size: 15px;
  cursor: pointer;
  pointer-events: auto;
  margin-right: 20px;
}

#fps-counter {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 10;
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  background: rgba(8, 13, 29, 0.78);
  color: #f2eee7;
  font: 12px/1.2 monospace;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

#game-hud {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  left: max(18px, env(safe-area-inset-left));
  z-index: 10;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  grid-template-rows: 34px minmax(0, 1fr);
  align-items: center;
  gap: 2px 10px;
  width: 300px;
  height: 90px;
  padding: 10px 12px;
  border-top: 2px solid var(--halloween-accent);
  background: rgba(13, 17, 19, 0.92);
  color: var(--halloween-bone);
  font-size: 16px;
  line-height: 1.35;
  pointer-events: none;
}

#game-hud[hidden],
#game-result[hidden] {
  display: none;
}

#game-timer {
  grid-column: 1;
  grid-row: 1 / 3;
  align-self: center;
  color: #ffcf88;
  font:
    700 29px/1 system-ui,
    sans-serif;
  font-variant-numeric: tabular-nums;
}

#ghost-count {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  min-width: 0;
  height: 30px;
  overflow: hidden;
}

#ghost-count img {
  display: block;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
}

#game-message {
  grid-column: 2;
  grid-row: 2;
  display: -webkit-box;
  width: 100%;
  max-width: none;
  max-height: 2.4em;
  overflow: hidden;
  color: var(--halloween-muted);
  font-size: 15px;
  line-height: 1.2;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

#crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 9;
  width: 22px;
  height: 22px;
  color: #f4eee1;
  pointer-events: none;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 1px 2px #101010);
  transition:
    color 120ms ease,
    transform 120ms ease;
}

#crosshair span {
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  background: currentColor;
  transform: translate(-50%, -50%);
}

#crosshair span:first-child {
  width: 2px;
  height: 22px;
}

#crosshair span:last-child {
  width: 22px;
  height: 2px;
}

#crosshair.is-hidden {
  visibility: hidden;
}

#crosshair.is-targeting {
  color: #a9dfbf;
  transform: translate(-50%, -50%) scale(1.2);
}

#penalty-notice {
  position: fixed;
  top: calc(50% - 76px);
  left: 50%;
  z-index: 12;
  color: #ff4b4b;
  font-size: 25px;
  font-weight: 800;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.9);
  pointer-events: none;
  transform: translateX(-50%);
}

#penalty-notice.is-visible {
  animation: penalty-notice 1s ease-out both;
}

@keyframes penalty-notice {
  0% {
    opacity: 0;
    transform: translate(-50%, 8px) scale(0.88);
  }

  15%,
  78% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -12px) scale(0.96);
  }
}

#game-result {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(5, 8, 15, 0.74);
}

.game-result-panel {
  width: min(100%, 420px);
  padding: 30px;
  border-top: 2px solid var(--halloween-accent);
  background: var(--halloween-panel);
  color: var(--halloween-bone);
  text-align: center;
  box-shadow: 0 16px 60px rgba(0, 0, 0, 0.45);
}

#game-result-kicker {
  margin: 0 0 8px;
  color: var(--halloween-accent);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#game-result-title {
  margin: 0 0 10px;
  font-size: 38px;
  font-family: "Caveat", cursive;
}

#game-result-copy {
  margin: 0 0 22px;
  color: var(--halloween-muted);
  font-size: 18px;
  line-height: 1.5;
}

#restart-game {
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  background: var(--halloween-accent);
  color: #1b1208;
  font:
    700 21px/1.1 "Caveat",
    cursive;
  font-weight: 700;
  cursor: pointer;
}

#restart-game:hover {
  background: #ffc16b;
}

@media (max-width: 560px) {
  #game-hud {
    top: max(12px, env(safe-area-inset-top));
    left: max(12px, env(safe-area-inset-left));
    width: min(270px, calc(100vw - 24px));
    height: 82px;
    grid-template-columns: 66px minmax(0, 1fr);
    grid-template-rows: 30px minmax(0, 1fr);
    gap: 2px 8px;
    padding: 8px 10px;
  }

  #game-timer {
    font-size: 21px;
  }

  #ghost-count {
    gap: 3px;
    height: 26px;
  }

  #ghost-count img {
    flex-basis: 24px;
    width: 24px;
    height: 24px;
  }

  #mobile-controls {
    right: max(12px, env(safe-area-inset-right));
    left: max(12px, env(safe-area-inset-left));
  }

  .game-result-panel {
    padding: 24px 18px;
  }
}

@supports (height: 100dvh) {
  #container {
    height: 100dvh;
  }
}

#start-btn {
  position: absolute;
  bottom: 10%;
  left: 50%;
  transform: translateX(-50%);
  padding: 15px 40px;
  font-size: 20px;
  background: #e63946;
  color: white;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  z-index: 100;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s;
}

#start-btn:hover {
  transform: translateX(-50%) scale(1.05);
}

#start-menu {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  padding: 24px;
  background: linear-gradient(
    110deg,
    rgba(5, 10, 13, 0.82),
    rgba(5, 10, 13, 0.42)
  );
  color: #f2eee7;
}

#start-menu[hidden],
#intro-caption[hidden] {
  display: none;
}

.menu-panel {
  box-sizing: border-box;
  width: min(100%, 540px);
  padding: clamp(24px, 5vw, 42px);
  border: 1px solid rgba(197, 230, 205, 0.32);
  border-left: 4px solid #a9dfbf;
  background: rgba(13, 21, 23, 0.94);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(12px);
}

.menu-kicker,
.intro-caption-label {
  margin: 0 0 8px;
  color: #a9dfbf;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

#menu-title {
  margin: 0;
  color: #fff1d2;
  font-family: "Caveat", cursive;
  font-size: clamp(38px, 8vw, 58px);
  font-weight: 700;
  line-height: 1;
}

.menu-copy {
  max-width: 430px;
  margin: 14px 0 24px;
  color: #d3d8d1;
  font-size: 15px;
  line-height: 1.55;
}

/* ================================================
   SELECTOR DE DIFICULTAD — tarjetas tipo card
   ================================================ */
#difficulty-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 18px;
  padding: 0;
  border: 0;
}

#difficulty-options legend {
  width: 100%;
  margin-bottom: 12px;
  color: var(--halloween-bone);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Ocultar el radio nativo */
#difficulty-options input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.diff-card {
  position: relative;
  cursor: pointer;
  display: block;
}

.diff-card-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 10px;
  box-sizing: border-box;
  border: 1.5px solid rgba(255, 241, 210, 0.18);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  text-align: center;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
  min-height: 140px;
  justify-content: center;
}

.diff-card-inner:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(244, 163, 64, 0.45);
  transform: translateY(-2px);
}

.diff-emoji {
  font-size: 28px;
  line-height: 1;
  display: block;
}

.diff-name {
  color: var(--halloween-bone);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  font-family: "Caveat", cursive;
}

.diff-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
}

.diff-tag {
  padding: 2px 7px;
  border-radius: 100px;
  background: rgba(255, 241, 210, 0.1);
  color: var(--halloween-muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.diff-detail {
  color: #b8b0a0;
  font-size: 12px;
  line-height: 1.35;
}

/* Estado seleccionado */
#difficulty-options input:checked + .diff-card-inner {
  border-color: var(--halloween-accent);
  background: rgba(244, 163, 64, 0.14);
  transform: translateY(-2px);
  box-shadow: 0 0 0 2px rgba(244, 163, 64, 0.25);
}

#difficulty-options input:checked + .diff-card-inner .diff-tag {
  background: rgba(244, 163, 64, 0.2);
  color: var(--halloween-bone);
}

#difficulty-options input:checked + .diff-card-inner .diff-name {
  color: var(--halloween-accent);
}

#difficulty-options input:focus-visible + .diff-card-inner {
  outline: 2px solid var(--halloween-accent);
  outline-offset: 3px;
}

/* Mantener retrocompatibilidad: si hay span sin clase (viejo HTML) */
#difficulty-options
  span:not(.diff-card-inner):not(.diff-tags):not(.diff-tag):not(
    .diff-emoji
  ):not(.diff-name):not(.diff-detail) {
  display: grid;
  min-height: 76px;
  align-content: center;
  justify-items: center;
  gap: 6px;
  padding: 8px 5px;
  box-sizing: border-box;
  border: 1px solid rgba(242, 238, 231, 0.25);
  background: rgba(255, 255, 255, 0.04);
  color: #d3d8d1;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  transition:
    background 150ms ease,
    border-color 150ms ease,
    color 150ms ease;
}

#difficulty-options small {
  color: #c2b9a8;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
}

/* ================================================
   ACCIONES DEL MENÚ
   ================================================ */
.menu-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.menu-actions button {
  min-height: 50px;
  padding: 0 18px;
  border: 1px solid var(--halloween-accent);
  background: var(--halloween-accent);
  color: #1b1208;
  font:
    700 21px/1.1 "Caveat",
    cursive;
  cursor: pointer;
  border-radius: 4px;
  width: 100%;
  transition:
    background 150ms ease,
    transform 80ms ease;
}

.menu-actions button:hover:not(:disabled) {
  background: #ffc16b;
  transform: translateY(-1px);
}

.menu-actions button:active:not(:disabled) {
  transform: translateY(0);
}

.menu-actions button:disabled {
  border-color: #75644f;
  background: #75644f;
  color: #c0a880;
  cursor: wait;
}

.menu-actions #exit-game,
.menu-actions #show-instructions,
.menu-actions #show-credits {
  border-color: rgba(255, 241, 210, 0.25);
  background: rgba(255, 255, 255, 0.05);
  color: var(--halloween-bone);
}

.menu-actions #exit-game:hover,
.menu-actions #show-instructions:hover,
.menu-actions #show-credits:hover {
  background: rgba(255, 255, 255, 0.12);
}

#menu-status {
  min-height: 18px;
  margin: 14px 0 0;
  color: #a9dfbf;
  font-size: 12px;
}

#instructions-dialog,
#credits-dialog {
  width: min(430px, calc(100% - 32px));
  max-width: none;
  padding: 0;
  border: 1px solid rgba(197, 230, 205, 0.38);
  border-top: 3px solid #a9dfbf;
  background: #171b20;
  color: #f2eee7;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

#instructions-dialog::backdrop,
#credits-dialog::backdrop {
  background: rgba(5, 8, 15, 0.76);
  backdrop-filter: blur(4px);
}

.instructions-panel {
  padding: 26px;
}

#instructions-title {
  margin: 0 0 12px;
  color: #fff1d2;
  font-family: "Caveat", cursive;
  font-size: 34px;
  line-height: 1;
}

#instructions-text {
  margin: 0 0 22px;
  color: #d3d8d1;
  font-size: 15px;
  line-height: 1.6;
}

.credits-panel {
  max-height: min(75vh, 620px);
  overflow-y: auto;
  padding: 26px;
}

#credits-title {
  margin: 0 0 18px;
  color: #fff1d2;
  font-family: "Caveat", cursive;
  font-size: 34px;
  line-height: 1;
}

.credits-panel h3 {
  margin: 18px 0 8px;
  color: #a9dfbf;
  font-size: 13px;
  text-transform: uppercase;
}

.credits-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
  color: #d3d8d1;
  font-size: 14px;
  line-height: 1.5;
}

.credits-list a {
  color: #b9e9ca;
  text-underline-offset: 3px;
}

.sound-credits {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
  gap: 6px 14px;
  margin: 0 0 22px;
  color: #d3d8d1;
  font-size: 13px;
  line-height: 1.4;
}

.sound-credits dt {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.sound-credits dd {
  margin: 0;
  color: #adb9b3;
}

#close-instructions,
#close-credits {
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid #a9dfbf;
  background: #a9dfbf;
  color: #151a18;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

#close-instructions:hover {
  background: #c1f0d4;
}

#intro-caption {
  position: fixed;
  right: 20px;
  bottom: max(28px, env(safe-area-inset-bottom));
  left: 20px;
  z-index: 15;
  box-sizing: border-box;
  width: min(560px, calc(100% - 40px));
  margin: 0 auto;
  padding: 17px 22px;
  border: 1px solid rgba(242, 238, 231, 0.36);
  border-radius: 4px;
  background: rgba(13, 21, 23, 0.94);
  color: #f2eee7;
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.4);
  text-align: center;
  pointer-events: auto;
}

#intro-caption p {
  margin: 0;
  font-family: "Caveat", cursive;
  font-size: 25px;
  line-height: 1.15;
}

#intro-accept {
  min-height: 42px;
  margin-top: 14px;
  padding: 0 20px;
  border: 1px solid #a9dfbf;
  background: #a9dfbf;
  color: #151a18;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

#intro-accept:hover {
  background: #c1f0d4;
}

#intro-accept:focus-visible {
  outline: 2px solid #fff1d2;
  outline-offset: 3px;
}

@media (max-width: 560px) {
  #start-menu {
    padding: 14px;
  }

  .menu-panel {
    padding: 24px 20px;
  }

  .menu-copy {
    margin-bottom: 18px;
    font-size: 14px;
  }

  #difficulty-options {
    gap: 5px;
  }

  #difficulty-options small {
    font-size: 9px;
  }

  .menu-actions button {
    flex: 1 1 140px;
  }

  #intro-caption {
    bottom: calc(max(20px, env(safe-area-inset-bottom)) + 128px);
    padding: 14px 16px;
  }

  #intro-caption p {
    font-size: 22px;
  }
}

.red {
  color: #e63946 !important;
}

.next-page-btn {
  position: absolute;
  left: 50%;
  margin-left: -32px;
  bottom: max(20px, env(safe-area-inset-bottom));
  display: none;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: #e63946;
  color: white;
  cursor: pointer;
  z-index: 100;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.next-page-btn:hover {
  transform: scale(1.05);
}

.arrow-icon {
  position: relative;
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}

.arrow-icon::after {
  position: absolute;
  top: 50%;
  right: 1px;
  width: 9px;
  height: 9px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  content: "";
  transform: translateY(-50%) rotate(45deg);
}

.text-source-host {
  position: absolute;
  visibility: hidden;
  pointer-events: none;
}

.card-copy {
  box-sizing: border-box;
  width: 440px;
  color: #29221d;
  font-family: "Caveat", "Segoe Print", "Comic Sans MS", cursive;
  font-size: 22px;
  font-weight: 500;
  line-height: 1.08;
}

.card-copy h2 {
  margin: 10px 0 20px;
  font-size: 30px;
  font-weight: 600;
  line-height: 1;
  text-align: center;
  color: #0064e9;
}

.card-copy p {
  margin: 0 0 30px;
}

.card-copy p:last-child {
  margin-bottom: 0;
}

.card-copy--right {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.card-copy--right p {
  margin: 0;
}

.card-photo {
  display: block;
  width: 190px;
  height: 190px;
  margin: 0 auto;
  border-radius: 4px;
  object-fit: cover;
}

#credits-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  font-size: 24px;
  font-weight: bold;
  background: #e63946;
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  z-index: 100;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s;
}

#credits-btn:hover {
  transform: scale(1.1);
}

#credits-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 200;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: white;
  padding: 30px;
  border-radius: 15px;
  text-align: center;
  max-width: 400px;
  position: relative;
}

.close-modal {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 24px;
  cursor: pointer;
  color: #333;
}

#controls {
  position: absolute;
  bottom: 20px;
  right: 20px;
  display: none;
  align-items: center;
  gap: 10px;
  z-index: 100;
}

.control-btn {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  padding: 0;
  background: #e63946;
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s;
}

.control-btn:hover {
  transform: scale(1.1);
}

#mute-btn .control-icon {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

#reload-btn {
  font-size: 24px;
}

#mute-btn[data-playing="true"] .icon-play,
#mute-btn[data-playing="false"] .icon-pause {
  display: none;
}

#loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #0064e9;
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
  color: white;
  font-size: 24px;
  transition: opacity 1.5s ease-in-out;
}

#start-menu {
  padding: max(16px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
  overflow-y: auto;
  background: rgba(8, 11, 13, 0.72);
}

.menu-panel {
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  border: 1px solid rgba(255, 241, 210, 0.15);
  /*border-top: 2px solid var(--halloween-accent);*/
  border-left: 1px solid rgba(255, 241, 210, 0.15);
  background: rgba(13, 17, 19, 0.97);
}

.menu-kicker,
.intro-caption-label,
#menu-status,
.credits-panel h3 {
  color: var(--halloween-accent);
}

#menu-title,
#instructions-title,
#credits-title {
  color: var(--halloween-bone);
  font-family: inherit;
}

.menu-copy,
#instructions-text {
  color: var(--halloween-muted);
}

#difficulty-options span {
  border-color: rgba(255, 241, 210, 0.2);
  background: rgba(255, 255, 255, 0.035);
  color: var(--halloween-muted);
}

#difficulty-options small {
  color: #c2b9a8;
  font-size: 12px;
}

#difficulty-options input:checked + span {
  border-color: var(--halloween-accent);
  background: rgba(244, 163, 64, 0.12);
  color: var(--halloween-bone);
}

#difficulty-options input:focus-visible + span {
  outline-color: var(--halloween-accent);
}

.menu-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.menu-actions button,
#close-instructions,
#close-credits,
#intro-accept,
#restart-game {
  border-color: var(--halloween-accent);
  background: var(--halloween-accent);
  color: #1b1208;
}

.menu-actions button:hover:not(:disabled),
#close-instructions:hover,
#close-credits:hover,
#intro-accept:hover,
#restart-game:hover {
  background: #ffc16b;
}

.menu-actions button:disabled {
  border-color: #75644f;
  background: #75644f;
}

.menu-actions #exit-game,
.menu-actions #show-instructions,
.menu-actions #show-credits {
  border-color: rgba(255, 241, 210, 0.25);
  background: transparent;
  color: var(--halloween-bone);
}

#instructions-dialog,
#credits-dialog {
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  border: 1px solid rgba(255, 241, 210, 0.15);
  border-top: 2px solid var(--halloween-accent);
  background: var(--halloween-panel);
}

#instructions-dialog::backdrop,
#credits-dialog::backdrop {
  background: rgba(5, 8, 10, 0.82);
}

.instructions-panel,
.credits-panel {
  padding: clamp(18px, 5vw, 28px);
}

#intro-caption {
  width: min(560px, calc(100% - 32px));
  border: 1px solid rgba(255, 241, 210, 0.15);
  border-top: 2px solid var(--halloween-accent);
  background: rgba(13, 17, 19, 0.97);
}

.mobile-joystick:active,
#inspect-button:active,
.joystick-stick {
  background-color: var(--halloween-accent);
}

#crosshair.is-targeting {
  color: var(--halloween-accent);
}

#game-hud {
  border-top: 2px solid var(--halloween-accent);
  border-left: 0;
  background: rgba(13, 17, 19, 0.92);
  color: var(--halloween-bone);
}

#game-result-kicker,
.credits-list a {
  color: var(--halloween-accent);
}

#menu-title,
#instructions-title,
#credits-title,
#game-result-title {
  font-family: "Caveat", cursive;
}

.menu-actions button,
#close-instructions,
#close-credits,
#intro-accept,
#restart-game {
  font-family: "Caveat", cursive;
  font-size: 21px;
}

.menu-kicker,
#menu-status,
#difficulty-options legend,
#difficulty-options strong,
#game-result-kicker,
.credits-panel h3 {
  font-size: 16px;
}

.menu-copy,
#instructions-text,
#game-result-copy {
  font-size: 18px;
}

#difficulty-options small {
  font-size: 14px;
}

.credits-list,
.sound-credits {
  font-size: 16px;
}

#intro-caption-label,
.intro-caption-label {
  font-family: system-ui, sans-serif;
  font-size: 15px;
}

#intro-caption p {
  font-family: system-ui, sans-serif;
  font-size: 20px;
  line-height: 1.4;
}

#game-message {
  font-size: 15px;
}

#penalty-notice {
  font-family: system-ui, sans-serif;
  font-size: 28px;
}

@media (max-width: 560px) {
  #start-menu {
    padding: max(10px, env(safe-area-inset-top))
      max(10px, env(safe-area-inset-right))
      max(10px, env(safe-area-inset-bottom))
      max(10px, env(safe-area-inset-left));
  }

  .menu-panel {
    width: 100%;
    /* Sin max-height para no forzar scroll en landscape */
    padding: 18px 14px;
  }

  #menu-title {
    font-size: clamp(30px, 9vw, 48px);
  }

  /* En móvil portrait estrecho: tarjetas en columna */
  #difficulty-options {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  /* En landscape en móvil pequeño: volver a 3 columnas */
  @media (orientation: landscape) {
    #difficulty-options {
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }
  }

  .menu-actions button {
    width: 100%;
    min-height: 44px;
  }

  #intro-caption {
    right: 12px;
    bottom: calc(max(14px, env(safe-area-inset-bottom)) + 132px);
    left: 12px;
    width: auto;
    padding: 12px 14px;
  }

  #intro-caption p {
    font-size: 18px;
  }

  #intro-accept {
    width: 100%;
    min-height: 44px;
  }
}

@media (max-height: 500px) {
  #start-menu {
    place-items: start center;
  }
}

/* ================================================
   OVERLAY: GIRAR DISPOSITIVO
   ================================================ */
#rotate-prompt {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #080b0d;
  color: var(--halloween-bone);
  pointer-events: all;
}

#rotate-prompt[hidden] {
  display: none;
}

.rotate-prompt-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 32px 24px;
  text-align: center;
}

.rotate-icon {
  width: 80px;
  height: 80px;
  color: var(--halloween-accent);
  animation: rotate-hint 2s ease-in-out infinite;
}

@keyframes rotate-hint {
  0%,
  100% {
    transform: rotate(0deg);
  }

  40% {
    transform: rotate(90deg);
  }

  60% {
    transform: rotate(90deg);
  }
}

.rotate-prompt-inner p {
  margin: 0;
  font-family: "Caveat", cursive;
  font-size: 28px;
  font-weight: 700;
  color: var(--halloween-bone);
}

.rotate-prompt-inner small {
  color: var(--halloween-muted);
  font-size: 15px;
  line-height: 1.4;
}

/* MENÚ PRINCIPAL COMPACTO Y ACCIONES DESPLEGABLES */
.menu-panel {
  position: relative;
  width: min(100%, 680px);
  max-height: 100%;
  overflow: visible;
  padding: clamp(24px, 4vw, 38px);
}

.menu-topbar {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
}

.menu-brand {
  display: none;
}

#menu-toggle {
  display: flex;
  align-items: center;
  gap: 10px; /* Espacio entre el icono y la palabra Menú */
  height: 42px;
  padding: 0 12px; /* Padding horizontal para que respire el contenido */
  border: 1px solid rgba(255, 241, 210, 0.25);
  border-radius: 5px;
  background: rgba(13, 17, 19, 0.88);
  cursor: pointer;
}

.hamburger-icon {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 21px;
  height: 14px;
}

#menu-toggle span {
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: var(--halloween-bone);
  transition:
    transform 150ms ease,
    opacity 150ms ease;
}

#menu-toggle div:not(.hamburger-icon) {
  color: var(--halloween-bone);
  font-size: 18px;
}

#menu-toggle[aria-expanded="true"] .hamburger-icon span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

#menu-toggle[aria-expanded="true"] .hamburger-icon span:nth-child(2) {
  opacity: 0;
}

#menu-toggle[aria-expanded="true"] .hamburger-icon span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.menu-actions {
  position: absolute;
  top: 50px;
  right: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  width: max-content;
  min-width: 180px;
  padding: 9px;
  border: 1px solid rgba(255, 241, 210, 0.2);
  border-radius: 6px;
  background: rgba(13, 17, 19, 0.98);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.menu-actions[hidden],
#start-game[hidden] {
  display: none !important;
}

.menu-actions button {
  min-height: 42px;
  padding: 7px 12px;
  border: 1px solid rgba(255, 241, 210, 0.2);
  border-radius: 4px;
  background: transparent;
  color: var(--halloween-bone);
  font:
    600 17px/1.2 system-ui,
    sans-serif;
  text-align: left;
  cursor: pointer;
}

.menu-actions button:hover {
  border-color: var(--halloween-accent);
  background: rgba(244, 163, 64, 0.12);
}

#menu-title {
  padding-right: 36px;
}

#menu-status {
  margin-bottom: 0;
}

.tutorial-repeat-option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 10px 0 14px;
  color: var(--halloween-muted);
  font:
    14px/1.35 system-ui,
    sans-serif;
}

.tutorial-repeat-option input {
  width: 18px;
  height: 18px;
  accent-color: var(--halloween-accent);
}

/* ================================================
   BOTÓN SALIR DE PANTALLA COMPLETA (durante juego)
   ================================================ */
#exit-fullscreen-btn {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(255, 241, 210, 0.22);
  border-radius: 20px;
  background: rgba(13, 17, 19, 0.88);
  color: var(--halloween-bone);
  font:
    600 14px/1 system-ui,
    sans-serif;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition:
    background 150ms ease,
    border-color 150ms ease,
    opacity 150ms ease;
  opacity: 0.75;
}

#exit-fullscreen-btn:hover {
  background: rgba(25, 32, 38, 0.96);
  border-color: rgba(255, 241, 210, 0.5);
  opacity: 1;
}

#exit-fullscreen-btn[hidden] {
  display: none;
}

/* En móvil ocultar texto, dejar solo icono */
@media (max-width: 560px) {
  #exit-fullscreen-btn span {
    display: none;
  }

  #exit-fullscreen-btn {
    padding: 0;
    width: 40px;
    justify-content: center;
  }
}

@media (max-width: 767px) {
  #start-menu {
    overflow: hidden;
    padding: max(10px, env(safe-area-inset-top))
      max(10px, env(safe-area-inset-right))
      max(10px, env(safe-area-inset-bottom))
      max(10px, env(safe-area-inset-left));
  }

  .menu-panel {
    width: min(100%, 720px);
    max-height: 100%;
    overflow: visible;
    padding: 22px clamp(16px, 4vw, 30px);
  }

  .menu-topbar {
    top: 10px;
    right: 10px;
  }

  #menu-title {
    font-size: clamp(32px, 7vw, 48px);
  }

  #difficulty-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    margin-bottom: 10px;
  }

  .diff-card-inner {
    min-height: 110px;
    gap: 4px;
    padding: 9px 5px;
  }

  .diff-emoji {
    font-size: 23px;
  }

  .diff-detail {
    display: none;
  }

  .menu-copy {
    max-width: 520px;
    margin: 10px 0 16px;
    font-size: 14px;
    line-height: 1.35;
  }

  #difficulty-options legend {
    margin-bottom: 8px;
  }

  #menu-status {
    font-size: 13px;
  }
}

@media (max-width: 380px) {
  .diff-tag {
    padding: 2px 5px;
    font-size: 10px;
  }

  .diff-card-inner {
    min-height: 100px;
  }
}

@media (max-height: 420px) and (max-width: 767px) {
  .menu-panel {
    padding-top: 16px;
    padding-bottom: 14px;
  }

  #menu-title {
    font-size: clamp(30px, 6vw, 40px);
  }

  .menu-copy {
    margin: 7px 0 10px;
  }

  .diff-card-inner {
    min-height: 92px;
    padding: 7px 4px;
  }
}

/* En escritorio: el paso 1 siempre visible, el indicador y botón Continuar ocultos */
@media (min-width: 768px) {
  .menu-panel {
    width: min(100%, 680px);
  }
}

/* ================================================
   CAPA FINAL: TEMA HALLOWEEN, TUTORIAL Y MÓVIL HORIZONTAL
   ================================================ */
:root {
  --hw-purple: #7c3aed;
  --hw-purple-deep: #1c1030;
  --hw-ecto: #8bf06a;
  --hw-glow: rgba(244, 163, 64, 0.35);
  --hw-surface: linear-gradient(
    160deg,
    rgba(36, 18, 52, 0.97),
    rgba(12, 10, 18, 0.98)
  );
}

#start-menu {
  background:
    radial-gradient(
      ellipse at 20% 0%,
      rgba(124, 58, 237, 0.28),
      transparent 55%
    ),
    radial-gradient(
      ellipse at 90% 100%,
      rgba(244, 163, 64, 0.16),
      transparent 50%
    ),
    rgba(6, 5, 12, 0.78);
}

.menu-panel {
  margin: auto;
  border: 1px solid rgba(244, 163, 64, 0.38);
  border-radius: 12px;
  background: var(--hw-surface);
  box-shadow:
    0 0 0 1px rgba(124, 58, 237, 0.25),
    0 24px 80px rgba(0, 0, 0, 0.6),
    0 0 60px rgba(124, 58, 237, 0.18);
}

.menu-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 120px;
  height: 120px;
  border-top-left-radius: 12px;
  pointer-events: none;
  opacity: 0.32;
  background:
    repeating-conic-gradient(
      from 90deg at 0 0,
      transparent 0 14deg,
      rgba(255, 241, 210, 0.6) 14deg 15deg
    ),
    repeating-radial-gradient(
      circle at 0 0,
      transparent 0 16px,
      rgba(255, 241, 210, 0.45) 16px 17px
    );
  -webkit-mask-image: linear-gradient(135deg, #000 35%, transparent 75%);
  mask-image: linear-gradient(135deg, #000 35%, transparent 75%);
}

.menu-content {
  position: relative;
}

.menu-content img {
  display: block;
  width: min(100%, 460px);
  height: auto;
  margin: 0 auto 8px;
  filter: drop-shadow(0 6px 18px rgba(124, 58, 237, 0.45));
}

@media (max-width: 560px) and (orientation: portrait) {
  #start-menu .menu-content img {
    width: min(calc(100% + 12px), 480px);
  }
}

.menu-kicker {
  letter-spacing: 0.08em;
}

#difficulty-options legend {
  color: var(--halloween-accent);
}

.diff-card-inner {
  border-radius: 10px;
  border-color: rgba(255, 241, 210, 0.16);
  background: rgba(255, 255, 255, 0.035);
}

.diff-card-inner:hover {
  border-color: rgba(139, 240, 106, 0.55);
}

#difficulty-options input:checked + .diff-card-inner {
  border-color: var(--halloween-accent);
  background: linear-gradient(
    160deg,
    rgba(244, 163, 64, 0.2),
    rgba(124, 58, 237, 0.14)
  );
  box-shadow:
    0 0 0 2px rgba(244, 163, 64, 0.3),
    0 0 22px var(--hw-glow);
}

#menu-toggle,
.menu-actions {
  border-color: rgba(244, 163, 64, 0.35);
  background: rgba(20, 12, 30, 0.95);
}

.menu-actions button,
#intro-accept,
#close-tutorial,
#close-credits,
#restart-game {
  border-radius: 8px;
  box-shadow: 0 0 18px rgba(244, 163, 64, 0.25);
  transition:
    background 150ms ease,
    transform 150ms ease,
    box-shadow 150ms ease;
}

#intro-accept,
#close-tutorial,
#close-credits,
#restart-game {
  border: 1px solid var(--halloween-accent);
  background: var(--halloween-accent);
  color: #1b1208;
  font:
    700 21px/1.1 "Caveat",
    cursive;
  min-height: 44px;
  padding: 0 22px;
  cursor: pointer;
}

#intro-accept:hover,
#close-tutorial:hover,
#restart-game:hover {
  background: #ffc16b;
  transform: translateY(-1px);
}

#intro-accept:focus-visible,
#close-tutorial:focus-visible,
.menu-actions button:focus-visible,
#menu-toggle:focus-visible,
#restart-game:focus-visible {
  outline: 2px solid var(--hw-ecto);
  outline-offset: 3px;
}

/* Diálogo de los fantasmas */
#intro-caption {
  border: 1px solid rgba(244, 163, 64, 0.45);
  border-radius: 12px;
  background: var(--hw-surface);
  box-shadow:
    0 0 0 1px rgba(124, 58, 237, 0.25),
    0 12px 40px rgba(0, 0, 0, 0.55);
}

#intro-caption .intro-caption-label {
  letter-spacing: 0.1em;
}

/* Modal de tutorial */
#tutorial-dialog,
#credits-dialog {
  box-sizing: border-box;
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  padding: 0;
  border: 1px solid rgba(244, 163, 64, 0.4);
  border-radius: 14px;
  background: var(--hw-surface);
  color: var(--halloween-bone);
  box-shadow:
    0 0 0 1px rgba(124, 58, 237, 0.28),
    0 24px 80px rgba(0, 0, 0, 0.65),
    0 0 50px rgba(124, 58, 237, 0.2);
}

#tutorial-dialog::backdrop,
#credits-dialog::backdrop {
  background: rgba(5, 3, 10, 0.85);
}

.tutorial-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: clamp(18px, 4vw, 28px);
  text-align: center;
}

.tutorial-intro,
.tutorial-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tutorial-kicker {
  color: var(--halloween-accent);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

#tutorial-title {
  margin: 0;
  color: var(--halloween-bone);
  font:
    700 clamp(34px, 6vw, 46px) / 1 "Caveat",
    cursive;
  text-shadow: 0 0 18px rgba(124, 58, 237, 0.7);
}

.tutorial-goal,
.tutorial-tip {
  margin: 0;
  color: var(--halloween-muted);
  font-size: 16px;
  line-height: 1.4;
}

.tutorial-tip {
  color: var(--hw-ecto);
  font-size: 14px;
}

.tutorial-steps {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  text-align: left;
}

.tutorial-steps[hidden] {
  display: none;
}

.tutorial-steps li {
  padding: 9px 12px;
  border: 1px solid rgba(255, 241, 210, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  font-size: 15px;
  line-height: 1.35;
}

.tutorial-steps kbd {
  display: inline-block;
  min-width: 1.4em;
  margin-right: 4px;
  padding: 1px 6px;
  border: 1px solid rgba(244, 163, 64, 0.6);
  border-radius: 5px;
  background: rgba(244, 163, 64, 0.14);
  color: var(--halloween-accent);
  font:
    700 13px/1.5 system-ui,
    sans-serif;
  text-align: center;
}

.tutorial-body .tutorial-repeat-option {
  margin: 0;
}

.credits-panel {
  padding: clamp(18px, 4vw, 28px);
}

/* Móvil / tablet horizontal: todo visible sin scroll */
@media (orientation: landscape) and (max-height: 520px) {
  #start-menu {
    place-items: center;
    overflow-y: auto;
    padding: max(8px, env(safe-area-inset-top))
      max(12px, env(safe-area-inset-right))
      max(8px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }

  .menu-panel {
    width: min(100%, 880px);
    max-height: none;
    padding: 14px 20px;
  }

  .menu-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    grid-template-areas:
      "kicker diff"
      "logo diff"
      "copy diff";
    grid-template-rows: auto auto 1fr;
    column-gap: 22px;
    align-items: center;
    padding-top: 36px;
  }

  .menu-kicker {
    grid-area: kicker;
    margin: 0 0 4px;
  }

  .menu-content img {
    grid-area: logo;
    width: auto;
    max-width: 100%;
    max-height: 34dvh;
    margin: 0 auto;
  }

  .menu-copy {
    grid-area: copy;
    margin: 8px 0 0;
    font-size: 13px;
    line-height: 1.35;
  }

  #difficulty-options {
    grid-area: diff;
    grid-template-columns: 1fr;
    gap: 7px;
    margin: 0;
  }

  #difficulty-options legend {
    margin-bottom: 6px;
    font-size: 13px;
  }

  .diff-card-inner {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    grid-template-areas:
      "emoji name"
      "emoji tags";
    column-gap: 8px;
    row-gap: 3px;
    min-height: 0;
    padding: 7px 10px;
    text-align: left;
  }

  .diff-emoji {
    grid-area: emoji;
    font-size: 26px;
    text-align: center;
  }

  .diff-name {
    grid-area: name;
    font-size: 19px;
  }

  .diff-tags {
    grid-area: tags;
    justify-content: flex-start;
  }

  .diff-detail {
    display: none;
  }

  .menu-topbar {
    top: 8px;
    right: 10px;
  }

  #menu-toggle {
    height: 36px;
  }

  .menu-brand {
    display: none;
  }

  /* Tutorial en dos columnas */
  #tutorial-dialog {
    width: min(760px, calc(100vw - 24px));
  }

  .tutorial-panel {
    flex-direction: row;
    align-items: center;
    gap: 20px;
    padding: 16px 20px;
  }

  .tutorial-intro,
  .tutorial-body {
    flex: 1 1 0;
    gap: 7px;
  }

  #tutorial-title {
    font-size: 34px;
  }

  .tutorial-steps li {
    padding: 6px 10px;
    font-size: 14px;
  }

  .tutorial-goal {
    font-size: 14px;
  }

  #intro-caption {
    width: min(520px, calc(100% - 40px));
    padding: 10px 16px;
  }

  #intro-caption p {
    font-size: 21px;
  }

  #intro-accept {
    min-height: 38px;
    margin-top: 8px;
  }

  #game-hud {
    width: 240px;
    height: 70px;
    grid-template-columns: 62px minmax(0, 1fr);
    grid-template-rows: 26px minmax(0, 1fr);
    padding: 6px 10px;
  }

  #game-timer {
    font-size: 22px;
  }

  #ghost-count {
    height: 24px;
  }

  #ghost-count img {
    flex-basis: 22px;
    width: 22px;
    height: 22px;
  }

  #game-message {
    font-size: 13px;
  }

  .mobile-joystick {
    width: 108px;
    height: 108px;
  }

  .joystick-stick {
    width: 46px;
    height: 46px;
  }

  #inspect-button {
    width: 78px;
    height: 78px;
  }

  .game-result-panel {
    padding: 18px;
  }

  #credits-dialog {
    width: min(720px, calc(100vw - 24px));
  }
}

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

/* En horizontal bajo, el diálogo va arriba para no tapar a los fantasmas */
@media (orientation: landscape) and (max-height: 520px) {
  #intro-caption {
    top: max(10px, env(safe-area-inset-top));
    bottom: auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "label action"
      "text action";
    column-gap: 16px;
    align-items: center;
    width: min(620px, calc(100% - 40px));
    text-align: left;
  }

  #intro-caption .intro-caption-label {
    grid-area: label;
    margin: 0;
  }

  #intro-caption p {
    grid-area: text;
    font-size: 19px;
  }

  #intro-accept {
    grid-area: action;
    margin-top: 0;
    white-space: nowrap;
  }
}

/* Títulos naranjas centrados */
.menu-kicker,
#difficulty-options legend {
  text-align: center;
}

#difficulty-options legend {
  padding: 0;
}

/* Tamaños: nombres de dificultad más grandes y móvil horizontal ligeramente mayor */
.diff-name {
  font-size: 23px;
}

@media (orientation: landscape) and (max-height: 520px) {
  .menu-content img {
    max-height: 46dvh;
  }

  .menu-copy {
    font-size: 15px;
  }

  .diff-name {
    font-size: 23px;
  }

  .diff-tag {
    padding: 2px 8px;
    font-size: 13px;
  }

  .diff-emoji {
    font-size: 30px;
  }

  .diff-card-inner {
    grid-template-columns: 42px minmax(0, 1fr);
    row-gap: 2px;
    padding: 6px 10px;
  }
}

/* GUI en juego y resultado con el mismo estilo Halloween */
#game-hud {
  border: 1px solid rgba(244, 163, 64, 0.45);
  border-radius: 12px;
  background: var(--hw-surface);
  box-shadow:
    0 0 0 1px rgba(124, 58, 237, 0.25),
    0 10px 30px rgba(0, 0, 0, 0.5);
}

#game-timer {
  color: var(--halloween-accent);
  text-shadow: 0 0 14px var(--hw-glow);
}

#game-message {
  color: var(--halloween-bone);
}

#ghost-count img {
  filter: drop-shadow(0 0 6px rgba(139, 240, 106, 0.55));
}

#game-result {
  background:
    radial-gradient(
      ellipse at 50% 0%,
      rgba(124, 58, 237, 0.3),
      transparent 60%
    ),
    rgba(5, 3, 10, 0.82);
}

.game-result-panel {
  position: relative;
  box-sizing: border-box;
  border: 1px solid rgba(244, 163, 64, 0.45);
  border-radius: 14px;
  background: var(--hw-surface);
  box-shadow:
    0 0 0 1px rgba(124, 58, 237, 0.28),
    0 24px 80px rgba(0, 0, 0, 0.65),
    0 0 50px rgba(124, 58, 237, 0.22);
}

#game-result-title {
  color: var(--halloween-bone);
  text-shadow: 0 0 18px rgba(124, 58, 237, 0.7);
}

#penalty-notice {
  text-shadow:
    0 0 14px rgba(255, 75, 75, 0.6),
    0 2px 5px rgba(0, 0, 0, 0.9);
}

.mobile-joystick {
  border-color: rgba(244, 163, 64, 0.55);
  box-shadow: 0 0 18px rgba(124, 58, 237, 0.35);
}

#inspect-button {
  background: var(--hw-surface);
  box-shadow: 0 0 18px var(--hw-glow);
  color: var(--halloween-bone);
}

#exit-fullscreen-btn {
  border-color: rgba(244, 163, 64, 0.4);
  background: rgba(20, 12, 30, 0.9);
}

.game-result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

#exit-result {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 44px;
  padding: 0 22px;
  border: 1px solid rgba(244, 163, 64, 0.5);
  border-radius: 8px;
  background: transparent;
  color: var(--halloween-bone);
  font:
    700 21px/1.1 "Caveat",
    cursive;
  text-decoration: none;
  transition:
    background 150ms ease,
    transform 150ms ease;
}

#exit-result:hover {
  background: rgba(244, 163, 64, 0.14);
  transform: translateY(-1px);
}

#exit-result:focus-visible {
  outline: 2px solid var(--hw-ecto);
  outline-offset: 3px;
}

.credits-columns {
  display: block;
}

@media (orientation: landscape) and (max-height: 520px) {
  #credits-dialog {
    width: min(820px, calc(100vw - 24px));
    max-height: calc(100dvh - 16px);
  }

  .credits-panel {
    padding: 12px 20px;
  }

  #credits-title {
    margin: 0 0 4px;
    font-size: 30px;
    line-height: 1;
  }

  .credits-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 24px;
  }

  .credits-panel h3 {
    margin: 8px 0 4px;
    font-size: 13px;
  }

  .credits-list,
  .sound-credits {
    margin: 0;
    font-size: 13px;
    line-height: 1.3;
  }

  .credits-list {
    padding-left: 18px;
  }

  .credits-list li {
    margin: 2px 0;
  }

  .sound-credits {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
  }

  .sound-credits dt {
    margin-top: 4px;
  }

  .sound-credits dd {
    margin: 0;
  }

  #close-credits {
    display: block;
    min-height: 36px;
    margin: 10px auto 0;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .models-credits {
    grid-template-columns: auto 1fr;
    column-gap: 10px;
    align-items: baseline;
  }

  .models-credits dt {
    margin-top: 0;
  }

  .credits-list li {
    margin: 0;
  }

  .credits-panel h3 {
    margin: 6px 0 3px;
  }

  #close-credits {
    margin-top: 8px;
  }
}
