:root {
  /* Paleta Eclipse Pictures */
  --black: #080808;   /* negro profundo */
  --warm: #F1EEE7;    /* blanco cálido */
  --grey: #777777;    /* gris cinematográfico */
  --gold: #B7A27A;    /* dorado tenue (acento) */
  --bg: var(--black);
  --fg: var(--warm);
  --muted: #a39f98;   /* gris cálido para texto secundario sobre negro (contraste AA) */
  --accent: var(--gold);
  --panel: rgba(8, 8, 8, 0.78);
  font-family: "Avenir Next", Avenir, "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--fg); overscroll-behavior: none; }
body { -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
#app canvas { display: block; }
[hidden] { display: none !important; }

kbd {
  display: inline-block;
  min-width: 1.7em;
  padding: 0.1em 0.45em;
  margin: 0 0.1em;
  border: 1px solid rgba(241, 238, 231, 0.35);
  border-bottom-width: 3px;
  border-radius: 6px;
  font-family: inherit; font-weight: 600; font-size: 0.85em; line-height: 1.4;
  text-align: center;
  background: rgba(241, 238, 231, 0.08);
}

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; }

#crosshair {
  position: absolute; left: 50%; top: 50%;
  width: 6px; height: 6px; margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: rgba(241, 238, 231, 0.85);
  box-shadow: 0 0 0 2px rgba(8, 8, 8, 0.4);
}

#room-name {
  position: absolute; top: 28px; left: 50%;
  transform: translate(-50%, -10px);
  padding: 8px 22px;
  border-left: 3px solid var(--room, var(--accent));
  background: var(--panel);
  font-size: 22px; font-weight: 400; letter-spacing: 0.12em; text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.4s, transform 0.4s;
}
#room-name.show { opacity: 1; transform: translate(-50%, 0); }

#prompt {
  position: absolute; left: 50%; bottom: 14%;
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: 10px;
  background: var(--panel);
  font-size: 18px;
  white-space: nowrap;
}

#minimap {
  position: absolute; right: 16px; top: 16px;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}
#minimap.big {
  right: 50%; top: 50%;
  transform: translate(50%, -50%);
  background: rgba(8, 8, 8, 0.9);
}

/* ---------- Menú ---------- */
#menu {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  padding: 16px;
  background: radial-gradient(ellipse at center, rgba(8, 8, 8, 0.7), rgba(8, 8, 8, 0.96));
}
#menu .card { width: 100%; max-width: 620px; text-align: center; }
#menu h1 { margin: 0 0 10px; font-size: 0; }
#menu h1 img { width: min(560px, 86vw); height: auto; }
#menu .sub { margin: 0 auto 30px; max-width: 30em; color: var(--fg); font-weight: 300; font-size: 17px; line-height: 1.6; }
#start-btn {
  padding: 14px 40px;
  border: 1px solid var(--gold); border-radius: 2px;
  background: transparent; color: var(--warm);
  font-family: inherit; font-weight: 500; font-size: 15px; letter-spacing: 0.22em; text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
#start-btn:hover:not(:disabled) { background: var(--gold); color: var(--black); }
#start-btn:disabled { opacity: 0.5; cursor: wait; }
#start-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
#menu .keys { list-style: none; padding: 0; margin: 28px 0 0; color: var(--muted); line-height: 2.2; font-size: 15px; }
#menu strong { color: var(--fg); font-weight: 500; }
#contact {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px;
  margin-top: 22px; padding-top: 18px;
  border-top: 1px solid rgba(183, 162, 122, 0.3);
  font-style: normal; font-size: 14px; color: var(--muted);
  -webkit-user-select: text; user-select: text;
}
#contact .contact-name { color: var(--fg); }
#contact a { color: var(--gold); text-decoration: none; }
#contact a:hover { text-decoration: underline; }
/* Manos con billetes: desactivadas en este sitio ("hands": false en mundo.json) */
body.no-hands .hands-only { display: none !important; }
#menu-status { min-height: 1.5em; color: var(--muted); font-size: 14px; }
#menu-status.error { color: #e08a7a; }

/* ---------- Visor de video ---------- */
#viewer {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  background: var(--black);
}
#viewer-frame { flex: 1; min-height: 0; }
#viewer-frame iframe, #viewer-frame video { width: 100%; height: 100%; border: 0; background: #000; }
#viewer-info {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 20px;
  background: var(--black);
  border-top: 1px solid rgba(183, 162, 122, 0.3);
}
#viewer-info h2 { margin: 0; font-size: 18px; font-weight: 500; letter-spacing: 0.02em; }
#viewer-info p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
#viewer-info a { color: var(--accent); white-space: nowrap; }
#viewer-close {
  position: absolute; top: 14px; right: 14px;
  width: 44px; height: 44px;
  border: 0; border-radius: 50%;
  background: var(--panel); color: var(--warm);
  font-size: 20px; cursor: pointer;
}

/* ---------- Celular / táctil ---------- */
.keys-touch, #pause-btn, #cash-btn, #rotate-hint { display: none; }
body.touch .keys-desktop { display: none; }
body.touch .keys-touch { display: block; }

#touch-layer {
  position: fixed; inset: 0;
  touch-action: none;
}
#joy-base {
  position: absolute;
  width: 120px; height: 120px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid rgba(241, 238, 231, 0.35);
  background: rgba(241, 238, 231, 0.08);
  pointer-events: none;
}
#joy-knob {
  position: absolute; left: 50%; top: 50%;
  width: 52px; height: 52px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(241, 238, 231, 0.55);
}

body.touch #pause-btn {
  display: block;
  position: absolute;
  top: calc(12px + env(safe-area-inset-top, 0px));
  left: calc(12px + env(safe-area-inset-left, 0px));
  width: 44px; height: 44px;
  border: 0; border-radius: 50%;
  background: var(--panel); color: var(--warm);
  font-size: 14px;
  pointer-events: auto;
}
body.touch #cash-btn {
  display: block;
  position: absolute;
  right: calc(20px + env(safe-area-inset-right, 0px));
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  width: 58px; height: 58px;
  border: 2px solid rgba(241, 238, 231, 0.6); border-radius: 50%;
  background: rgba(47, 107, 76, 0.85); color: var(--warm);
  font: 700 26px Georgia, serif;
  pointer-events: auto;
}
body.touch #cash-btn:active { transform: scale(0.92); }
body.touch #minimap {
  pointer-events: auto;
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: calc(12px + env(safe-area-inset-right, 0px));
}
body.touch #minimap.big { top: 50%; right: 50%; }
body.touch #prompt {
  pointer-events: auto;
  bottom: calc(18% + env(safe-area-inset-bottom, 0px));
  padding: 14px 20px;
  border: 2px solid rgba(241, 238, 231, 0.5);
  font-size: 16px;
  max-width: 80vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.touch #room-name { font-size: 20px; top: calc(16px + env(safe-area-inset-top, 0px)); }

@media (orientation: portrait) {
  body.touch #rotate-hint {
    display: block;
    position: absolute; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--panel);
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
  }
}

/* Menú y visor en pantallas chicas */
@media (max-width: 700px), (max-height: 500px) {
  #menu .keys { margin-top: 16px; line-height: 1.7; font-size: 14px; }
  #menu .sub { font-size: 15px; }
  #contact { margin-top: 14px; padding-top: 12px; font-size: 13px; }
  #menu .sub { margin-bottom: 16px; }
  #menu { overflow-y: auto; }
  #viewer-info { padding: 8px 14px; }
  #viewer-info p { display: none; }
}
#viewer-close { top: calc(14px + env(safe-area-inset-top, 0px)); right: calc(14px + env(safe-area-inset-right, 0px)); }
