:root {
  --rojo: #962017;
  --rojo-oscuro: #74160f;
  --crema: #faf3dd;
  --crema-oscura: #efe3c2;
  --marron: #643521;
  --marron-oscuro: #3f2014;
  --tinta: #1d1d1b;
  --verde: #2f6f44;
  --dorado: #d4a359;
  --borde: rgba(100, 53, 33, 0.24);
  --sombra: 0 12px 32px rgba(29, 29, 27, 0.36);
  --font-title: "Cinzel", Georgia, serif;
  --font-mono: "Courier Prime", Consolas, monospace;
  --font-sans: "Source Sans 3", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body, #app {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--marron-oscuro);
  color: var(--tinta);
  font-family: var(--font-sans);
  user-select: none;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.hidden {
  display: none !important;
}

.hud {
  position: fixed;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  z-index: 20;
}

.hud-left, .hud-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  pointer-events: auto;
}

.hud-brand, .hud-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--crema);
  border: 2px solid var(--marron);
  border-radius: 999px;
  padding: 6px 14px;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(29, 29, 27, 0.22);
}

.hud-pill {
  font-family: var(--font-mono);
  font-size: 13px;
}

.brand-icon {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--rojo);
  border: 2px solid var(--marron);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 18px;
  border-radius: 8px;
  border: 2px solid var(--marron-oscuro);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--rojo);
  color: var(--crema);
}

.btn-primary:hover {
  background: var(--rojo-oscuro);
}

.btn-secondary {
  background: var(--crema-oscura);
  color: var(--tinta);
}

.btn-paper {
  background: var(--crema);
  color: var(--tinta);
  box-shadow: 0 4px 12px rgba(29, 29, 27, 0.22);
}

.btn-success {
  background: var(--verde);
  color: var(--crema);
  box-shadow: 0 4px 16px rgba(47, 111, 68, 0.45);
  animation: pulseGlow 1.8s infinite;
}

.btn-icon {
  min-width: 40px;
  padding: 8px;
  background: var(--crema);
}

.zoom-controls {
  display: inline-flex;
  align-items: center;
  background: rgba(250, 243, 221, 0.94);
  border: 2px solid var(--marron-oscuro);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(29, 29, 27, 0.22);
}

.zoom-btn,
.zoom-readout {
  border: none;
  background: transparent;
  color: var(--tinta);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  height: 34px;
  cursor: pointer;
  transition: background 0.14s ease;
}

.zoom-btn {
  width: 30px;
  font-size: 16px;
  line-height: 1;
}

.zoom-readout {
  padding: 0 7px;
  font-size: 11px;
  border-left: 1px solid rgba(100, 53, 33, 0.22);
  border-right: 1px solid rgba(100, 53, 33, 0.22);
}

.zoom-btn:hover,
.zoom-readout:hover {
  background: rgba(150, 32, 23, 0.12);
}

.badge-count {
  background: var(--rojo);
  color: var(--crema);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 2px 7px;
  border-radius: 999px;
}

.minimap-wrap {
  position: fixed;
  bottom: 16px;
  left: 16px;
  background: rgba(250, 243, 221, 0.92);
  border: 2px solid var(--marron);
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 6px 18px rgba(29, 29, 27, 0.28);
  z-index: 15;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#minimap-canvas {
  border-radius: 6px;
  display: block;
}

.zone-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--marron);
  text-align: center;
}

.btn-action {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  border-radius: 999px;
  padding: 12px 24px;
  box-shadow: 0 8px 24px rgba(29, 29, 27, 0.4);
}

.btn-action:active {
  transform: translateX(-50%) scale(0.96);
}

.touch-controls {
  position: fixed;
  right: 20px;
  bottom: 24px;
  z-index: 18;
}

.joystick-base {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  background: rgba(250, 243, 221, 0.35);
  border: 2px solid rgba(100, 53, 33, 0.65);
  position: relative;
  touch-action: none;
}

.joystick-knob {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--rojo);
  border: 2px solid var(--crema);
  position: absolute;
  left: 30px;
  top: 30px;
  pointer-events: none;
}

.toast-ficha {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--marron-oscuro);
  color: var(--crema);
  border: 2px solid var(--dorado);
  border-radius: 999px;
  padding: 8px 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  z-index: 60;
  box-shadow: var(--sombra);
}

.overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 42%, rgba(18, 13, 12, 0.78) 0%, rgba(10, 8, 9, 0.91) 62%, rgba(5, 4, 6, 0.97) 100%);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 40;
}

.overlay--cover {
  padding: 0;
  background: #090A0F;
  backdrop-filter: none;
}

#casona-overlay {
  padding: 0;
}

.overlay--dark-intro {
  background: radial-gradient(circle at 50% 38%, rgba(20, 14, 13, 0.80) 0%, rgba(9, 8, 11, 0.93) 56%, rgba(4, 4, 6, 0.98) 100%);
}

.cover-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: clamp(24px, 6vw, 72px);
}

.cover-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.cover-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(9, 10, 15, 0.94) 0%, rgba(11, 10, 12, 0.72) 42%, rgba(10, 9, 11, 0.28) 74%, rgba(9, 10, 15, 0.56) 100%),
    linear-gradient(0deg, rgba(9, 10, 15, 0.82) 0%, transparent 38%);
  pointer-events: none;
}

.cover-sound {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 6;
  background: rgba(29, 29, 27, 0.65);
  color: var(--crema);
  border-color: rgba(250, 243, 221, 0.35);
  backdrop-filter: blur(6px);
}

.cover-layout {
  position: relative;
  z-index: 3;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.cover-menu {
  max-width: 440px;
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.cover-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dorado);
  margin-bottom: 12px;
}

.cover-eyebrow::before {
  content: "";
  width: 24px;
  height: 2px;
  background: var(--rojo);
}

.cover-menu h1 {
  font-family: var(--font-title);
  font-size: clamp(34px, 4.6vw, 56px);
  line-height: 1.02;
  color: var(--crema);
  letter-spacing: -0.02em;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.72);
  margin-bottom: 14px;
}

.cover-bajada {
  font-size: 17px;
  line-height: 1.45;
  color: var(--crema-oscura);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.75);
  max-width: 38ch;
  margin-bottom: 28px;
}

.cover-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 260px;
  margin-bottom: 24px;
}

.cover-actions .btn {
  width: 100%;
  min-height: 46px;
  justify-content: flex-start;
  padding: 10px 20px;
  font-size: 16px;
  border-radius: 6px;
}

.cover-actions .btn-primary {
  border-color: rgba(250, 243, 221, 0.35);
  box-shadow: 0 8px 24px rgba(150, 32, 23, 0.45);
}

.cover-btn-ghost {
  background: rgba(29, 29, 27, 0.55);
  color: var(--crema);
  border-color: rgba(250, 243, 221, 0.35);
  backdrop-filter: blur(4px);
}

.cover-btn-ghost:hover {
  background: rgba(250, 243, 221, 0.16);
}

.cover-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: rgba(250, 243, 221, 0.74);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.85);
}

.cover-hero {
  position: relative;
  align-self: flex-end;
  height: clamp(320px, 74vh, 660px);
  margin-right: clamp(0px, 5vw, 64px);
  margin-bottom: -24px;
  display: flex;
  align-items: flex-end;
  pointer-events: none;
}

.cover-hero::after {
  content: "";
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 72%;
  height: 26px;
  background: radial-gradient(ellipse at center, rgba(16, 11, 9, 0.65) 0%, transparent 72%);
  z-index: 0;
}

.cover-hero img, .cover-hero svg {
  position: relative;
  z-index: 1;
  height: 100%;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.45));
}

.paper-card, .casona-modal, .expediente-modal {
  background: var(--crema);
  border: 3px solid var(--marron);
  border-radius: 12px;
  box-shadow: var(--sombra);
  width: 100%;
  max-width: 560px;
  position: relative;
  overflow: hidden;
}

.paper-card {
  padding: 28px 24px;
  text-align: center;
}

.paper-card h1, .paper-card h2 {
  font-family: var(--font-title);
  color: var(--rojo);
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.paper-card p {
  font-size: 16px;
  line-height: 1.5;
  margin-bottom: 16px;
}

.logo-badge {
  width: 84px;
  height: 84px;
  margin: 0 auto 14px;
  border-radius: 50%;
  border: 3px solid var(--marron);
  background: var(--crema-oscura);
  display: grid;
  place-items: center;
}

.credit-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--marron);
  border-top: 1px solid var(--borde);
  padding-top: 10px;
  margin-top: 8px;
}

.input-field {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--marron);
  border-radius: 8px;
  background: #fffdf6;
  font-family: var(--font-mono);
  font-size: 16px;
  margin: 8px 0 16px;
}

.btn-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.howto-list {
  text-align: left;
  display: grid;
  gap: 10px;
  margin: 16px 0 20px;
  list-style: none;
}

.howto-list li {
  background: var(--crema-oscura);
  border-left: 4px solid var(--rojo);
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 14px;
}

.paper-card.encargo-story {
  max-width: 660px;
  background: linear-gradient(160deg, rgba(22, 17, 16, 0.92) 0%, rgba(12, 10, 11, 0.96) 100%);
  border: 1px solid rgba(212, 163, 89, 0.34);
  color: var(--crema);
  padding: 36px 34px 30px;
  text-align: left;
  box-shadow: 0 28px 64px rgba(0, 0, 0, 0.72);
}

.encargo-kicker {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dorado);
  margin-bottom: 8px;
}

.encargo-story h2 {
  color: var(--crema);
  font-size: clamp(24px, 3vw, 30px);
  margin-bottom: 16px;
}

.encargo-narrative {
  font-size: 18px;
  line-height: 1.68;
  color: rgba(250, 243, 221, 0.92);
  min-height: 116px;
  max-width: 65ch;
  margin-bottom: 14px;
}

.encargo-cursor {
  display: inline-block;
  color: var(--dorado);
  font-weight: 700;
  margin-left: 2px;
  animation: blinkCursor 0.8s steps(2, start) infinite;
}

.encargo-cursor.is-done {
  display: none;
}

.encargo-skip-hint {
  font-family: var(--font-mono);
  font-size: 12px;
  color: rgba(212, 163, 89, 0.72);
  margin-bottom: 18px;
}

.encargo-skip-hint.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.encargo-btn {
  opacity: 0.52;
  transition: opacity 0.25s ease, transform 0.2s ease;
}

.encargo-btn.is-ready {
  opacity: 1;
}

@keyframes blinkCursor {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.casona-modal {
  width: 100vw;
  max-width: none;
  height: 100vh;
  max-height: 100vh;
  background: #120E0D;
  color: var(--crema);
  border: none;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.expediente-modal {
  width: min(1160px, 95vw);
  max-width: 1160px;
  height: min(740px, 88vh);
  max-height: 88vh;
  background: #2B201A;
  color: var(--crema);
  border: 2px solid #6E523C;
  border-radius: 12px;
  box-shadow: 0 28px 72px rgba(0, 0, 0, 0.78);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.expediente-modal .casona-header {
  background: linear-gradient(180deg, #4B221B 0%, #371813 100%);
  border-bottom: 1px solid rgba(212, 163, 89, 0.28);
  padding: 14px 22px;
}

.casona-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.casona-backdrop svg,
.casona-backdrop img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0.90;
  filter: saturate(0.95);
}

.casona-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 34%, rgba(18, 12, 10, 0.22) 0%, rgba(10, 8, 8, 0.56) 74%),
    linear-gradient(180deg, rgba(10, 8, 8, 0.64) 0%, rgba(12, 9, 8, 0.30) 44%, rgba(9, 7, 7, 0.72) 100%);
}

.casona-modal .casona-header,
.casona-modal .casona-tabs,
.casona-modal .casona-panel,
.casona-modal #modal-dialogue-slot {
  position: relative;
  z-index: 2;
}

.casona-modal .casona-header {
  background: rgba(24, 15, 13, 0.78);
  border-bottom: 1px solid rgba(212, 163, 89, 0.25);
  backdrop-filter: blur(6px);
  padding: 16px 24px;
}

.casona-modal .casona-header h2 {
  font-size: clamp(20px, 2.4vw, 26px);
  letter-spacing: -0.01em;
}

.casona-header {
  background: var(--rojo);
  color: var(--crema);
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.casona-header h2 {
  font-family: var(--font-title);
  font-size: 20px;
  color: var(--crema);
}

.casona-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  opacity: 0.9;
  letter-spacing: 0.08em;
}

.casona-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--crema);
  background: transparent;
  color: var(--crema);
  font-weight: 700;
  cursor: pointer;
}

.stamp {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--crema);
  border: 2px solid var(--crema);
  padding: 3px 8px;
  border-radius: 4px;
  transform: rotate(-6deg);
}

.casona-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 24px 0;
  background: rgba(16, 12, 11, 0.72);
  border-bottom: 1px solid rgba(255, 245, 224, 0.14);
  overflow-x: auto;
}

.tab-btn {
  padding: 10px 14px;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 8px 8px 0 0;
  background: transparent;
  font-weight: 700;
  font-size: 13px;
  color: rgba(250, 243, 221, 0.66);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.tab-btn:hover {
  color: var(--crema);
  background: rgba(255, 245, 224, 0.06);
}

.tab-btn.active {
  background: rgba(212, 163, 89, 0.12);
  border-bottom-color: var(--dorado);
  color: var(--crema);
}

.tab-btn.locked {
  opacity: 0.48;
}

.casona-panel {
  padding: 18px 28px 22px;
  overflow: hidden;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.casona-panel.is-talking .casona-intro-strip,
.casona-panel.is-talking .npc-stage-cast {
  opacity: 0.14;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.expediente-list {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 14px 22px 18px;
  overflow: hidden;
}

.casona-intro-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 10px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255, 245, 224, 0.14);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dorado);
  flex-shrink: 0;
}

.npc-stage-cast {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(32px, 8vw, 128px);
  padding: 8px 24px 12px;
}

.npc-figure {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  color: var(--crema);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  transition: transform 0.22s ease, filter 0.22s ease;
}

.npc-figure:hover,
.npc-figure:focus-visible {
  outline: none;
  transform: translateY(-8px);
}

.npc-figure-art {
  width: clamp(200px, 27vw, 350px);
  height: clamp(240px, 49vh, 430px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: transparent;
  border: none;
  overflow: visible;
}

.npc-figure-art img,
.npc-figure-art svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom center;
  display: block;
  filter: drop-shadow(0 16px 26px rgba(0, 0, 0, 0.80));
  transition: filter 0.22s ease;
}

.npc-figure:first-child:not(:only-child) .npc-figure-art img {
  transform: scaleX(-1);
}

.npc-figure:hover .npc-figure-art img,
.npc-figure:focus-visible .npc-figure-art img {
  filter: drop-shadow(0 20px 30px rgba(0, 0, 0, 0.88)) drop-shadow(0 0 12px rgba(212, 163, 89, 0.45));
}

.npc-figure-label {
  margin-top: -12px;
  position: relative;
  z-index: 2;
  background: rgba(14, 11, 10, 0.86);
  border: 1px solid rgba(212, 163, 89, 0.42);
  border-radius: 10px;
  padding: 8px 18px;
  min-width: 224px;
  text-align: center;
  backdrop-filter: blur(6px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.56);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.npc-figure.talked .npc-figure-label {
  border-color: rgba(95, 166, 117, 0.72);
  background: rgba(16, 26, 20, 0.88);
}

.npc-figure-label strong {
  display: block;
  font-size: 16px;
  color: var(--crema);
}

.npc-figure-label span {
  font-size: 13px;
  color: var(--dorado);
}

.npc-status {
  font-family: var(--font-mono);
  font-size: 11px;
  color: rgba(250, 243, 221, 0.78);
  margin-top: 3px;
}

.npc-figure.talked .npc-status {
  color: #8CD9A4;
}

.interior-layout {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(290px, 370px);
  gap: 24px;
  align-items: center;
}

.interior-stage-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.interior-lead {
  font-size: 14px;
  line-height: 1.45;
  color: rgba(250, 243, 221, 0.88);
  margin: 0;
}

.interior-scene {
  position: relative;
  border: 2px solid rgba(212, 163, 89, 0.45);
  border-radius: 12px;
  overflow: hidden;
  background: #241914;
  aspect-ratio: 16 / 9;
  width: 100%;
  max-height: calc(100vh - 220px);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.65);
}

.interior-bg-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hotspot-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--crema);
  background: var(--rojo);
  color: var(--crema);
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.hotspot-pin.visited {
  background: var(--verde);
}

.hotspot-pin.is-active {
  transform: translate(-50%, -50%) scale(1.16);
  box-shadow: 0 0 0 4px rgba(212, 163, 89, 0.52), 0 6px 14px rgba(0, 0, 0, 0.6);
}

.interior-side-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.hotspot-selector-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hs-pill {
  text-align: left;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid rgba(250, 243, 221, 0.18);
  background: rgba(16, 12, 11, 0.76);
  color: rgba(250, 243, 221, 0.86);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.hs-pill.active {
  border-color: var(--dorado);
  background: rgba(212, 163, 89, 0.18);
  color: var(--crema);
}

.hs-pill.visited {
  border-left: 3px solid #5FA675;
}

.notes-stage-center {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.legal-notes-board {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 380px));
  justify-content: center;
  align-content: center;
  gap: 24px;
}

.paper-note {
  position: relative;
  background:
    repeating-linear-gradient(transparent, transparent 25px, rgba(139, 90, 43, 0.08) 26px),
    linear-gradient(180deg, #FBF4E1 0%, #EFE1BE 100%);
  color: #1D1D1B;
  border: 1px solid #CBB68A;
  border-radius: 4px 12px 6px 6px;
  padding: 24px 22px 18px;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.56);
}

.paper-note.is-locked {
  max-width: 440px;
}

.paper-note.is-pending {
  background: linear-gradient(180deg, #DED2BA 0%, #CFC0A3 100%);
  border: 1px dashed #8B7355;
  color: #4A3D32;
}

.note-tilt-0 { transform: rotate(-0.7deg); }
.note-tilt-1 { transform: rotate(0.6deg); }
.note-tilt-2 { transform: rotate(-0.35deg); }

.note-pin {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #E05246 0%, #962017 70%, #58100A 100%);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.45);
}

.note-tag {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #7B4B27;
  margin-bottom: 6px;
}

.paper-note h4 {
  font-family: var(--font-title);
  font-size: 18px;
  color: #8B1E17;
  margin-bottom: 8px;
}

.note-highlight {
  font-size: 14px;
  font-weight: 700;
  color: #1D1D1B;
  border-left: 3px solid #962017;
  padding-left: 10px;
  margin-bottom: 8px;
  line-height: 1.44;
}

.note-body {
  font-size: 13.5px;
  line-height: 1.5;
  color: #2C241E;
}

.paper-note .source-line {
  color: #6B5038;
}

.paper-note .source-line a {
  color: #8B1E17;
  font-weight: 700;
}

.note-stamp-ok {
  position: absolute;
  top: 14px;
  right: 16px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #962017;
  border: 1.5px solid #962017;
  padding: 2px 6px;
  border-radius: 3px;
  transform: rotate(-6deg);
  opacity: 0.86;
}

.paper-facsimile {
  max-width: 740px;
  width: 100%;
  background: linear-gradient(180deg, #F9F2E2 0%, #EDE0C2 100%);
  color: #1E1916;
  border: 1px solid #BFA97E;
  border-radius: 4px;
  padding: 28px 32px;
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.62);
}

.facsimile-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 2px solid #8B5A2B;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: #5D3A1A;
}

.facsimile-stamp {
  border: 2px solid #962017;
  color: #962017;
  padding: 3px 9px;
  border-radius: 3px;
  transform: rotate(-4deg);
  letter-spacing: 0.08em;
}

.paper-facsimile h4 {
  font-family: var(--font-title);
  font-size: 22px;
  color: #1D1D1B;
  margin-bottom: 6px;
}

.facsimile-sub {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #6B5038;
  margin-bottom: 14px;
}

.facsimile-quote {
  margin: 0;
  padding: 14px 18px;
  border-left: 4px solid #962017;
  background: rgba(139, 90, 43, 0.08);
  font-size: 15px;
  line-height: 1.62;
  color: #1E1916;
}

.ayerhoy-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.ayerhoy-meta {
  width: min(100%, calc((100vh - 235px) * 16 / 9));
  max-width: 980px;
}

.source-line {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--marron);
  margin-top: 8px;
  display: block;
}

.ayerhoy-stage .source-line {
  color: rgba(250, 243, 221, 0.78);
  margin-top: 4px;
}

.compare-wrap {
  position: relative;
  width: min(100%, calc((100vh - 235px) * 16 / 9));
  max-width: 980px;
  max-height: calc(100vh - 235px);
  aspect-ratio: 16 / 9;
  border: 2px solid rgba(212, 163, 89, 0.52);
  border-radius: 10px;
  overflow: hidden;
  cursor: ew-resize;
  touch-action: none;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.68);
}

.compare-layer {
  position: absolute;
  inset: 0;
}

.compare-layer svg {
  width: 100%;
  height: 100%;
  display: block;
}

.compare-ayer {
  clip-path: inset(0 50% 0 0);
}

.compare-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  background: var(--crema);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.compare-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--rojo);
  color: var(--crema);
  border: 2px solid var(--crema);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  pointer-events: none;
}

.compare-captions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--crema);
  margin-top: 6px;
}

.expediente-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 14px;
  margin-bottom: 10px;
  background: rgba(16, 11, 9, 0.45);
  border: 1px solid rgba(212, 163, 89, 0.28);
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--crema);
  flex-shrink: 0;
}

.folder-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  padding: 0 8px;
  align-items: end;
  flex-shrink: 0;
}

.folder-tab {
  background: #B89F77;
  color: #2B2018;
  border: 1px solid #7C6343;
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  padding: 7px 10px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 1px;
  transition: background 0.15s ease, padding-top 0.15s ease;
}

.folder-tab span {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  opacity: 0.8;
}

.folder-tab strong {
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder-tab small {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
}

.folder-tab.active {
  background: #EDE0C0;
  color: #1D1D1B;
  padding-top: 10px;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.24);
}

.folder-tab.done small {
  color: #235D3A;
}

.folder-sheet {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #EDE0C0 0%, #DFCCA3 100%);
  color: #1E1916;
  border: 1px solid #9D8156;
  border-radius: 4px 10px 10px 10px;
  padding: 18px 22px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 12px 30px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.folder-sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 10px;
  margin-bottom: 16px;
  border-bottom: 2px solid #8B5A2B;
  flex-shrink: 0;
}

.folder-sheet-head span {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: #6B4A2B;
}

.folder-sheet-head h3 {
  font-family: var(--font-title);
  font-size: 20px;
  color: #1D1D1B;
}

.folder-notes-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 18px;
  align-content: start;
}

.dialogue-bar.dialogue-vn {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: min(860px, calc(100% - 28px));
  z-index: 55;
  cursor: pointer;
}

#modal-dialogue-slot .dialogue-bar.dialogue-vn {
  position: relative;
  bottom: auto;
  left: auto;
  transform: none;
  width: 100%;
  padding: 12px 24px 20px;
  background: linear-gradient(180deg, rgba(10, 8, 8, 0) 0%, rgba(10, 8, 8, 0.84) 24%, rgba(10, 8, 8, 0.96) 100%);
  z-index: 6;
}

.dialogue-stage {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 16px;
  width: 100%;
}

.dialogue-bar.is-player .dialogue-stage {
  flex-direction: row;
}

.dialogue-bar.is-npc .dialogue-stage {
  flex-direction: row-reverse;
}

.dialogue-bar.is-system .dialogue-portrait {
  display: none;
}

.dialogue-portrait {
  width: clamp(134px, 19vw, 192px);
  height: clamp(154px, 22vw, 222px);
  flex-shrink: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  overflow: visible;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.68));
  animation: speakerPop 0.2s ease-out;
}

#modal-dialogue-slot .dialogue-portrait {
  width: clamp(120px, 15vw, 166px);
  height: clamp(142px, 18vw, 192px);
}

.dialogue-portrait img,
.dialogue-portrait svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom center;
  display: block;
}

.dialogue-box {
  flex: 1;
  max-width: 650px;
  position: relative;
  background: rgba(15, 22, 29, 0.94);
  border: 2px solid #598F96;
  border-radius: 14px;
  padding: 24px 22px 14px;
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(8px);
}

.dialogue-bar.is-player .dialogue-box {
  border-color: #D4A359;
  background: rgba(24, 17, 14, 0.94);
}

.dialogue-bar.is-system .dialogue-box {
  border-color: var(--rojo);
  background: rgba(24, 15, 14, 0.95);
}

.dialogue-top {
  position: absolute;
  top: -16px;
  left: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}

.dialogue-speaker {
  display: inline-block;
  background: #2C7E84;
  color: #FAF6EC;
  border: 1.5px solid rgba(255, 255, 255, 0.28);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  padding: 4px 16px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.36);
}

.dialogue-bar.is-player .dialogue-speaker {
  background: var(--rojo);
  border-color: var(--dorado);
}

.dialogue-bar.is-system .dialogue-speaker {
  background: var(--rojo);
}

.dialogue-role {
  background: rgba(12, 17, 22, 0.95);
  color: #D7E5E8;
  border: 1px solid rgba(105, 174, 180, 0.55);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 3px 10px;
  border-radius: 6px;
  text-transform: uppercase;
}

.dialogue-bar.is-player .dialogue-role {
  color: #F4DBA8;
  border-color: rgba(212, 163, 89, 0.55);
}

.dialogue-text {
  color: #F6F0E3;
  font-size: 16px;
  line-height: 1.48;
  min-height: 48px;
  margin-bottom: 10px;
}

.dialogue-footer {
  display: flex;
  justify-content: flex-end;
}

.dialogue-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #2D8A8E;
  color: #FAF8F2;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 8px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

.dialogue-bar.is-player .dialogue-cta {
  background: var(--rojo);
}

@keyframes speakerPop {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.ficha-card {
  position: relative;
  border-left: 5px solid var(--rojo);
}

.ficha-card.pendiente {
  border-left-color: #9e9689;
  opacity: 0.72;
}

.social-links {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 14px 0;
}

.social-link {
  text-decoration: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 700;
  color: #fff;
  background: var(--tinta);
}

.social-link.fb {
  background: #1877f2;
}

.credit-footer {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--borde);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--marron);
}

@keyframes pulseGlow {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

@keyframes heroFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@media (max-width: 780px) {
  .cover-stage {
    align-items: flex-end;
    padding: 20px;
  }
  .cover-layout {
    flex-direction: column-reverse;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 12px;
  }
  .cover-scrim {
    background: linear-gradient(0deg, rgba(16, 11, 9, 0.92) 0%, rgba(16, 11, 9, 0.58) 55%, rgba(16, 11, 9, 0.15) 100%);
  }
  .cover-hero {
    position: absolute;
    right: -12px;
    bottom: 0;
    height: 46vh;
    margin: 0;
    opacity: 0.92;
  }
  .cover-menu {
    position: relative;
    z-index: 4;
    width: 100%;
  }
  .cover-actions {
    width: min(240px, 68%);
  }
  .casona-panel,
  .expediente-list,
  .folder-sheet {
    overflow-y: auto;
  }
  .npc-stage-cast {
    flex-wrap: wrap;
    gap: 18px;
    align-items: center;
  }
  .npc-figure-art {
    width: 170px;
    height: 210px;
  }
  .interior-layout {
    grid-template-columns: 1fr;
  }
  .folder-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .compare-wrap,
  .ayerhoy-meta {
    width: 100%;
    max-height: none;
  }
}

@media (max-width: 680px) {
  .minimap-wrap {
    width: 118px;
    bottom: 12px;
    left: 12px;
  }
  #minimap-canvas {
    width: 102px;
    height: 76px;
  }
  .casona-header h2 {
    font-size: 16px;
  }
  .dialogue-stage {
    gap: 10px;
  }
  .dialogue-portrait,
  #modal-dialogue-slot .dialogue-portrait {
    width: 96px;
    height: 116px;
  }
  .dialogue-box {
    padding: 22px 14px 12px;
  }
  .dialogue-text {
    font-size: 14px;
  }
  .dialogue-role {
    display: none;
  }
}
