:root {
  --bg: #0f1220;
  --text: #e7e8ee;
  --muted: #9aa0b2;
  --accent: #7aa7ff;
  --danger: #ff6b6b;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --radius: 16px;
  --border: 1px solid rgba(255, 255, 255, 0.08);
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;

  --stage-w: 1440;
  --stage-h: 810;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  /* Elimina scroll global */
}

body {
  background: radial-gradient(1400px 900px at 20% 10%, #1b2350 0%, var(--bg) 55%);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans,
    Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

.app {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
  padding: 12px;
  gap: 12px;
}

/* ================= TOPBAR ================= */

.topbar {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 4px;
  border: var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.logo {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(122, 167, 255, 0.15);
  border: var(--border);
}

.title {
  font-weight: 700;
  letter-spacing: 0.2px;
}

.subtitle {
  color: var(--muted);
  font-size: 13px;
}

/* ✅ NUEVO: meta de escena en header */
.scene-meta {
  flex: 1;
  min-width: 240px;
  text-align: center;
  padding: 6px 10px;
  border-radius: 14px;
  border: var(--border);
  background: rgba(0, 0, 0, 0.14);
}

.scene-meta__title {
  font-weight: 900;
  font-size: 16px;
  line-height: 1.1;
}

.scene-meta__sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.2;
}

.top-actions {
  display: flex;
  gap: 10px;
}

.btn {
  border: var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.05s ease, background 0.15s ease;
  font-weight: 600;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.09);
}

.btn:active {
  transform: translateY(1px);
}

.btn-danger {
  background: rgba(255, 107, 107, 0.1);
  border-color: rgba(255, 107, 107, 0.35);
}

.btn-danger:hover {
  background: rgba(255, 107, 107, 0.16);
}

/* ================= LAYOUT ================= */

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
  /* Asegura que el contenido se ajuste */
}

.game {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ===========================
   ✅ ESCENA RESPONSIVE (1440×810)
   =========================== */

.scene {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-radius: var(--radius);
  border: var(--border);
  background: rgba(255, 255, 255, 0.03);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.scene-viewport {
  position: relative;
  flex: 1;
  width: 100%;
  margin: 0 auto;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(122, 167, 255, 0.18), rgba(255, 255, 255, 0.02));
  border-bottom: var(--border);
}

.scene-stage {
  position: absolute;
  left: 0;
  top: 0;
  width: calc(var(--stage-w) * 1px);
  height: calc(var(--stage-h) * 1px);
  transform-origin: top left;
}

/* =========================================================
   ✅ FONDO DE ESCENA (solo imagen/overlay, sin cartel centrado)
   ========================================================= */

.scene-bg {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 0;
  background: linear-gradient(135deg, rgba(122, 167, 255, 0.18), rgba(255, 255, 255, 0.02));
  background-repeat: no-repeat;
  background-position: center;
  transition: background-image 0.5s ease-in-out;
  animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.scene-bg--image {
  background-size: cover;
}

/* Overlay suave para legibilidad de hotspots (opcional) */
.scene-bg--image::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.10), rgba(0, 0, 0, 0.10));
}

/* ================= HOTSPOTS (SIEMPRE VISIBLES) ================= */

.hotspots {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hotspot {
  position: absolute;
  border: 2px dashed rgba(255, 0, 0, 0.6);
  background: rgba(255, 0, 0, 0.12);
  box-sizing: border-box;
  pointer-events: auto;
  cursor: pointer;
}

.hotspot.exit {
  border-style: solid;
}

.tooltip {
  position: absolute;
  z-index: 50;
  pointer-events: none;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.55);
  border: var(--border);
  box-shadow: var(--shadow);
  font-weight: 800;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
}

/* ================= HUD ================= */

.hud {
  display: grid;
  grid-template-columns: 660px 1fr 260px;
  gap: 12px;
  padding: 4px;
}

.panel-title {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin: 2px 0 8px;
}

.verbs,
.info,
.inventory {
  background: rgba(0, 0, 0, 0.12);
  border: var(--border);
  border-radius: 14px;
  padding: 10px;
  min-height: 80px;
}

.verbs-bar {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.verb-btn {
  border: var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 4px 10px;
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  font-weight: 700;
}

.verb-btn small {


  color: var(--muted);
  font-weight: 600;
  margin-top: 2px;
  font-size: 12px;
}

.verb-btn.active {
  background: rgba(122, 167, 255, 0.16);
  border-color: rgba(122, 167, 255, 0.55);
}

.feedback {
  color: var(--muted);
  line-height: 1.35;
  white-space: pre-wrap;
}

.inventory-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.item-pill {
  border: var(--border);
  background: rgba(255, 255, 255, 0.04);
  padding: 8px 10px;
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  font-weight: 700;
}

.item-pill.active {
  background: rgba(122, 167, 255, 0.16);
  border-color: rgba(122, 167, 255, 0.55);
}

.footer {
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 10px 0;
}

@media (max-width: 900px) {
  .hud {
    grid-template-columns: 1fr;
  }

  /* ✅ En móvil, el meta baja de línea */
  .topbar {
    flex-wrap: wrap;
  }

  .scene-meta {
    order: 3;
    width: 100%;
    text-align: left;
  }
}

/* ========== MODAL DIALOGO v0.3 ========== */

.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.dialog-overlay.open {
  display: flex;
}

.dialog-modal {
  width: min(760px, 96vw);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(20, 22, 35, 0.95);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.dialog-title {
  font-weight: 900;
  letter-spacing: 0.2px;
}

.btn-small {
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13px;
}

.dialog-text {
  padding: 14px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.92);
  white-space: pre-wrap;
}

.dialog-options-title {
  padding: 0 14px 8px;
  color: rgba(255, 255, 255, 0.65);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.14em;
}

.dialog-options {
  padding: 0 14px 14px;
  display: grid;
  gap: 10px;
}

.dialog-option {
  text-align: left;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.92);
  cursor: pointer;
  font-weight: 800;
}

.dialog-option:hover {
  background: rgba(122, 167, 255, 0.14);
  border-color: rgba(122, 167, 255, 0.45);
}

/* ✅ estados deshabilitados */

.hotspot--disabled {
  cursor: not-allowed;
  opacity: 0.78;
}

.verb-btn:disabled,
.verb-btn--disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.4);
}

.verb-btn:disabled {
  background: rgba(0, 0, 0, 0.12);
  border-color: rgba(255, 255, 255, 0.06);
}

.verb-btn:disabled small {
  color: rgba(255, 255, 255, 0.35);
}

/* ACTION LINE PRO */
.action-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.action-token {
  border: var(--border);
  background: rgba(255, 255, 255, 0.04);
  padding: 8px 10px;
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  font-weight: 700;
  color: var(--text);
}

.action-token:hover {
  background: rgba(255, 255, 255, 0.06);
}

.action-token--verb {
  background: rgba(122, 167, 255, 0.14);
  border-color: rgba(122, 167, 255, 0.45);
}

.action-token--cancel {
  background: rgba(255, 107, 107, 0.12);
  border-color: rgba(255, 107, 107, 0.35);
}

.action-token--placeholder {
  opacity: 0.65;
  cursor: default;
}

.action-token--static {
  cursor: default;
}

.action-token--disabled,
.action-token:disabled {
  opacity: 0.55;
  cursor: default;
}

.action-sep {
  color: rgba(255, 255, 255, 0.7);
  font-weight: 800;
}