@import url('https://fonts.googleapis.com/css2?family=Marcellus&family=Nanum+Myeongjo:wght@400;700&family=Cinzel+Decorative:wght@400;700&display=swap');
:root {
  --font-display: 'Cinzel Decorative', cursive;
}

:root {
  --gold: #c5a021;
  --gold-dark: #8e6e1d;
  --paper-bg: #f9f5e8;
  --ink: #1c1917;
  --accent: #7c2d12;
  --font-title: 'Marcellus', serif;
  --font-story: 'Nanum Myeongjo', serif;
  --font-display: 'Cinzel Decorative', cursive;
}

/* ... existing reset and container styles ... */

* { margin: 0; padding: 0; box-sizing: border-box; }
html { background: #000; height: 100%; overflow: hidden; }
body { background: #000; color: #fff; font-family: var(--font-story); overflow: hidden; height: 100vh; height: 100dvh; }

.pro-container {
  height: 100vh; width: 100vw; position: relative;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
  background: #000;
}

.background-blur {
  position: absolute;
  top: -5%; left: -5%; width: 110%; height: 110%;
  background-size: cover;
  background-position: center;
  filter: blur(30px) brightness(0.5) saturate(1.2);
  z-index: 0;
}

.background-art {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 80%;
  background-size: contain;
  background-position: center top;
  background-repeat: no-repeat;
  z-index: 1;
}

.vignette {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background:
    linear-gradient(to right, rgba(0,0,0,0.6) 0%, transparent 15%, transparent 85%, rgba(0,0,0,0.6) 100%),
    linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 30%);
  z-index: 2;
  pointer-events: none;
}

/* Status Dashboard */
.status-dashboard {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 30;
  background: rgba(0,0,0,0.7);
  padding: 15px;
  border: 1px solid var(--gold-dark);
  border-radius: 4px;
  width: 250px;
}

.status-item {
  margin-bottom: 10px;
}

.status-label {
  font-family: var(--font-title);
  color: var(--gold);
  font-size: 0.8rem;
  text-transform: uppercase;
  display: block;
  margin-bottom: 5px;
}

.status-bar-container {
  width: 100%;
  height: 8px;
  background: #333;
  border-radius: 4px;
  overflow: hidden;
}

.status-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
  white-space: nowrap;
}

.status-bar.favor { background: linear-gradient(90deg, #5b21b6, #8b5cf6); }
.status-bar.armada { background: linear-gradient(90deg, #1e3a8a, #3b82f6); }

/* Navigation Control */
.nav-control {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 30;
}

.map-btn {
  background: var(--gold);
  color: #000;
  border: none;
  padding: 10px 20px;
  font-family: var(--font-title);
  cursor: pointer;
  border-radius: 4px;
  font-weight: bold;
  transition: all 0.3s ease;
}

.map-btn:hover { background: #fff; }

.nav-overlay {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.9);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
}

.nav-menu {
  background: var(--paper-bg) url('/clean_parchment.webp');
  padding: 3rem;
  border-radius: 8px;
  text-align: center;
  border: 4px solid var(--gold);
}

.nav-menu h3 {
  font-family: var(--font-title);
  color: var(--accent);
  margin-bottom: 2rem;
  font-size: 1.5rem;
}

.nav-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}

.nav-loc {
  background: rgba(0,0,0,0.05);
  border: 1px solid var(--gold);
  padding: 15px 30px;
  font-family: var(--font-story);
  color: var(--ink);
  cursor: pointer;
  transition: 0.3s;
}

.nav-loc.active { background: var(--gold); color: #000; font-weight: bold; }
.nav-loc:hover:not(.active) { background: rgba(0,0,0,0.2); }

.close-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 30px;
  cursor: pointer;
}

/* Existing HUD styles ... */
.hud-box {
  width: 100%;
  max-width: 1000px;
  z-index: 100;
  padding: 0 20px;
  position: absolute;
  bottom: 20px;
}
.parchment-sheet {
  background: rgba(249, 245, 232, 0.92) url('/clean_parchment.webp') center/cover;
  background-blend-mode: overlay;
  padding: 1.1rem 2rem 1.2rem;
  border-radius: 6px;
  box-shadow: 0 -4px 30px rgba(0,0,0,0.5), 0 15px 40px rgba(0,0,0,0.7);
  border-left: 5px solid var(--gold);
  position: relative;
}
.pro-text {
  color: var(--ink);
  font-size: 1.1rem;
  line-height: 1.4;
  margin-bottom: 0.7rem;
  font-weight: 700;
  min-height: 2rem;
}
.pro-options {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.pro-option {
  background: rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.1);
  padding: 0.65rem 1.2rem;
  font-family: var(--font-story);
  font-size: 1rem;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 1rem;
  border-radius: 3px;
}
.pro-option:hover { background: var(--gold); color: #000; transform: translateX(8px); }
.opt-num { font-family: var(--font-title); font-weight: bold; color: var(--accent); }
.header-overlay { position: absolute; top: 40px; width: 100%; text-align: center; z-index: 10; }
.header-overlay h2 { font-family: var(--font-title); color: var(--gold); font-size: 1.2rem; letter-spacing: 5px; text-transform: uppercase; background: rgba(0,0,0,0.4); display: inline-block; padding: 8px 30px; border: 1px solid rgba(197, 160, 33, 0.3); border-radius: 5px; }
.portrait-container { position: absolute; bottom: 180px; left: 2%; z-index: 15; width: 160px; }
.portrait-img { width: 100%; border-radius: 5px; border: 2px solid var(--gold); filter: drop-shadow(0 0 20px rgba(0,0,0,0.8)); }
.portrait-name { background: var(--gold); color: #000; font-family: var(--font-title); font-size: 0.8rem; padding: 2px 10px; margin-top: -10px; position: relative; display: inline-block; font-weight: bold; }

/* Animations */
.hidden { display: none !important; }
.animate-slide-up { animation: slideUp 0.6s ease-out; }
@keyframes slideUp { from { transform: translateY(50px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.animate-fade-in { animation: fadeIn 0.8s ease-out; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ========================
   TITLE SCREEN
   ======================== */

.title-screen {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Ken Burns effect: two layers alternating */
.title-bg {
  position: absolute;
  inset: -5%;
  background: url('/palacio_viso_epic.webp') center / cover no-repeat;
  z-index: 0;
  animation: kenBurns 30s ease-in-out infinite alternate;
  filter: brightness(0.6) contrast(1.1);
}

.title-bg-2 {
  background: radial-gradient(circle at center, transparent 20%, rgba(0,0,0,0.4) 100%);
  z-index: 1;
}

@keyframes kenBurns {
  0%   { transform: scale(1.0) translateX(0); }
  100% { transform: scale(1.1) translateX(2%); }
}

.title-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.7) 100%);
  z-index: 1;
}

/* Floating dust particles */
.particles { position: absolute; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
.particle {
  position: absolute;
  bottom: -10px;
  border-radius: 50%;
  background: rgba(255, 220, 100, 0.7);
  animation: floatUp linear infinite;
}
@keyframes floatUp {
  from { transform: translateY(0) translateX(0); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 0.5; }
  to   { transform: translateY(-100vh) translateX(20px); opacity: 0; }
}

/* Main content layout */
.title-content {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: flex-end;
  gap: 4rem;
  padding: 2rem;
  padding-bottom: 5rem;
  max-width: 1400px;
  width: 100%;
}

/* Hero Faded Portrait */
.hero-faded-portrait {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 90vh;
  width: 50vw;
  z-index: 5;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
}

/* Hero Portrait - Cinematic Fade */
.hero-portrait {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 90vh;
  width: 50vw;
  z-index: 5;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
}

.hero-portrait img {
  height: 100%;
  width: auto;
  object-fit: contain;
  /* Cinematic Radial/Oval Mask - Fixes 'residual' vertical edges */
  mask-image: radial-gradient(ellipse 45% 45% at 45% 50%, rgba(0,0,0,1) 0%, rgba(0,0,0,1) 50%, rgba(0,0,0,0) 100%);
  -webkit-mask-image: radial-gradient(ellipse 45% 45% at 45% 50%, rgba(0,0,0,1) 0%, rgba(0,0,0,1) 50%, rgba(0,0,0,0) 100%);
  
  filter: drop-shadow(0 0 30px rgba(0,0,0,0.8));
  opacity: 1;
}

/* Text block */
.title-text-block {
  flex: 1;
  z-index: 10;
  padding: 4rem;
  background: linear-gradient(to right, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.5) 70%, transparent 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}
.title-pretitle {
  font-family: var(--font-title);
  color: var(--gold);
  font-size: 1.1rem;
  letter-spacing: 6px;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  font-weight: bold;
  text-shadow: 2px 2px 4px #000;
}
.title-main {
  font-family: var(--font-display);
  font-size: 6rem;
  line-height: 0.95;
  color: #ffffff;
  text-shadow: 0 5px 20px rgba(0,0,0,1), 0 0 10px rgba(197,160,33,0.3);
  margin-bottom: 1rem;
  text-transform: uppercase;
}
.title-subtitle {
  font-family: var(--font-title);
  font-size: 1.4rem;
  color: #ffffff;
  letter-spacing: 1px;
  margin-bottom: 2rem;
  text-shadow: 2px 2px 4px #000;
  max-width: 600px;
}
.title-separator {
  color: var(--gold);
  font-size: 1.5rem;
  letter-spacing: 12px;
  margin-bottom: 2.5rem;
  filter: drop-shadow(0 0 5px #000);
}

/* Buttons */
.title-actions { display: flex; gap: 1.5rem; flex-wrap: wrap; }

.btn-primary {
  background: linear-gradient(135deg, var(--gold) 0%, #dab84a 50%, var(--gold) 100%);
  color: #000;
  border: 1px solid rgba(255,255,255,0.4);
  padding: 1.2rem 3rem;
  font-family: var(--font-display);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  letter-spacing: 3px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0,0,0,0.4);
}
.btn-primary::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: 0.5s;
}
.btn-primary:hover::before {
  left: 100%;
}
.btn-primary:hover {
  background: #fff;
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 15px 35px rgba(197,160,33,0.6);
}

.btn-secondary {
  background: transparent;
  color: rgba(255,255,255,0.7);
  border: 1px solid rgba(255,255,255,0.3);
  padding: 1.2rem 2rem;
  font-family: var(--font-title);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
}
.btn-secondary:hover {
  border-color: var(--gold);
  color: var(--gold);
}

/* Footer & Branding */
.title-footer {
  position: absolute;
  bottom: 0px;
  left: 0;
  width: 100%;
  padding: 1.5rem 3rem;
  z-index: 10;
  font-family: var(--font-title);
  color: rgba(255,255,255,0.3);
  font-size: 0.9rem;
  letter-spacing: 4px;
  text-transform: uppercase;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
}
.copyright-link {
  color: var(--gold);
  text-decoration: none;
  opacity: 0.6;
  transition: opacity 0.3s ease;
  font-weight: bold;
}
.copyright-link:hover {
  opacity: 1;
  text-decoration: underline;
}

.btn-icon {
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--gold);
  color: var(--gold);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all 0.3s ease;
}
.btn-icon:hover {
  background: var(--gold);
  color: #000;
  transform: scale(1.1);
}

/* Credits panel */
.credits-panel {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}
.credits-body {
  background: var(--paper-bg) url('/clean_parchment.webp') center/cover;
  padding: 3rem 4rem;
  max-width: 600px;
  text-align: center;
  border: 3px solid var(--gold);
  color: var(--ink);
  font-family: var(--font-story);
  font-size: 1.2rem;
  line-height: 1.6;
}
.credits-body h3 {
  font-family: var(--font-display);
  color: var(--accent);
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
}

/* Title screen exit animation */
.fade-out { animation: fadeOut 0.8s ease-out forwards; }
@keyframes fadeOut { to { opacity: 0; transform: scale(1.05); } }

/* Entrance animations */
.animate-rise    { animation: riseIn 1.2s cubic-bezier(0.2,0.8,0.3,1) both; }
.animate-fade-down { animation: fadeDown 1s ease both; }
.animate-fade-up   { animation: fadeUp 1s ease both; }
.delay-1 { animation-delay: 0.3s; }
.delay-2 { animation-delay: 0.6s; }
.delay-3 { animation-delay: 0.9s; }
.delay-4 { animation-delay: 1.2s; }

@keyframes riseIn {
  from { transform: translateY(60px); opacity: 0; filter: blur(4px); }
  to   { transform: translateY(0); opacity: 1; filter: blur(0); }
}
@keyframes fadeDown {
  from { transform: translateY(-20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
@keyframes fadeUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* RPG UI Elements */
.viso-shield {
  position: absolute;
  top: -90px;
  left: 50%;
  transform: translateX(-50%);
  width: 160px;
  height: 160px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}
.shield-frame {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: sepia(1) saturate(5) hue-rotate(-30deg) brightness(1.3) drop-shadow(0 0 15px rgba(199, 168, 122, 0.4));
}
.shield-text {
  position: absolute;
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: bold;
  color: #1a1410;
  top: 48%;
  letter-spacing: 4px;
  text-shadow: 1px 1px 0px rgba(255,255,255,0.3);
}

.how-to-play {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(199, 168, 122, 0.25);
  border-left: 4px solid var(--gold);
  padding: 1.2rem;
  margin-top: 1.5rem;
  max-width: 600px;
  border-radius: 6px;
  text-align: left;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  transition: transform 0.3s ease;
}
.how-to-play:hover {
    transform: translateY(-2px);
    border-color: rgba(199, 168, 122, 0.5);
}
.how-to-play h3 {
  font-family: var(--font-title);
  color: var(--gold);
  font-size: 1rem;
  letter-spacing: 2px;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
}
.how-to-play p {
  font-size: 1rem;
  color: rgba(255,255,255,0.8);
  line-height: 1.6;
  margin: 0;
}

.inventory-bar {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(199, 168, 122, 0.2);
  width: 100%;
}
.inventory-slots {
  display: flex;
  gap: 0.8rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}
.inv-item {
  width: 40px;
  height: 40px;
  background: var(--gold);
  color: #1a1410;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-title);
  font-weight: bold;
  border-radius: 4px;
  cursor: help;
  box-shadow: 0 4px 15px rgba(0,0,0,0.5);
  font-size: 1.2rem;
  border: 1px solid #fff;
}
.empty-inv {
  font-family: var(--font-story);
  font-style: italic;
  opacity: 0.5;
  font-size: 0.9rem;
  color: #fff;
}

.game-over-btn {
  background: #7a1a1a !important;
  color: #fff !important;
  border: 2px solid var(--gold) !important;
  justify-content: center !important;
  font-weight: bold;
  letter-spacing: 4px;
  font-size: 1.4rem !important;
  margin-top: 2rem;
}
.game-over-btn:hover {
  background: #c00 !important;
  box-shadow: 0 0 30px rgba(255,0,0,0.4);
}
/* ========================
   MOBILE RESPONSIVENESS
   ======================== */

.locked-option {
    opacity: 0.5;
    cursor: not-allowed !important;
    background: rgba(50, 0, 0, 0.3) !important;
    border-color: rgba(100,0,0,0.3) !important;
}
.locked-option:hover {
    transform: none !important;
    background: rgba(50, 0, 0, 0.3) !important;
}

.act-label {
  font-family: var(--font-title);
  color: var(--gold);
  font-size: 0.75rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  text-align: center;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(197,160,33,0.3);
  width: 100%;
}

/* Typing state: subtle dim while text animates, but buttons remain clickable */
.options-typing .pro-option:not(.game-over-btn) {
  opacity: 0.5;
}
.achv-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #5b21b6;
    color: #ffd700;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: bold;
    z-index: 9999;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
    border: 1px solid #ffd700;
    transition: opacity 0.5s ease;
}
.achv-panel {
    background: rgba(17, 24, 39, 0.95);
    padding: 2rem;
    border: 1px solid var(--gold);
    border-radius: 10px;
    max-width: 400px;
    text-align: center;
    position: relative;
    z-index: 10000;
}
.achv-list {
    text-align: left;
    margin-top: 1rem;
    color: white;
}
.achv-item {
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.achv-item.locked {
    opacity: 0.4;
    filter: grayscale(100%);
}

body.cinematic-mode::before, body.cinematic-mode::after {
    content: ''; position: fixed; left: 0; right: 0; height: 12vh; background: #000; z-index: 50;
    transition: transform 1.5s cubic-bezier(0.25, 1, 0.5, 1);
    pointer-events: none;
}
body.cinematic-mode::before { top: 0; transform: translateY(-100%); }
body.cinematic-mode::after { bottom: 0; transform: translateY(100%); }

body.cinematic-mode.active-bars::before { transform: translateY(0); }
body.cinematic-mode.active-bars::after { transform: translateY(0); }

.fx-candle {
    animation: candle-flicker 4s infinite alternate;
}
@keyframes candle-flicker {
    0% { opacity: 0.8; }
    25% { opacity: 0.95; }
    50% { opacity: 0.85; }
    75% { opacity: 0.9; }
    100% { opacity: 0.75; }
}

.fx-smoke {
    position: absolute;
    inset: 0;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200"><filter id="a"><feTurbulence type="fractalNoise" baseFrequency="0.01 0.01" numOctaves="3" result="noise"/><feColorMatrix type="matrix" values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0.5 0" in="noise"/></filter><rect width="100%" height="100%" filter="url(%23a)"/></svg>');
    opacity: 0.3;
    animation: smoke-move 20s linear infinite;
    mix-blend-mode: screen;
    pointer-events: none;
    z-index: 5;
}
@keyframes smoke-move {
    0% { background-position: 0% 0%; }
    100% { background-position: 100% 100%; }
}

.shake {
    animation: screen-shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}
@keyframes screen-shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

.damage-flash::after {
    content: ''; position: fixed; inset: 0; background: rgba(255,0,0,0.4); z-index: 9999; pointer-events: none; animation: flash-fade 0.5s forwards;
}
@keyframes flash-fade { 100% { opacity: 0; } }

.char-breathe {
    animation: breathe 4s ease-in-out infinite;
    transform-origin: bottom center;
}
@keyframes breathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02) translateY(-2px); }
}

/* Puzzles */

.puzzle-box { padding: 1rem; background: rgba(0,0,0,0.3); border-radius: 8px; border: 1px solid var(--gold-dark); margin-top: 1rem; }
.puzzle-q { font-family: 'Cinzel', serif; font-size: 1.2rem; color: var(--gold); margin-bottom: 1.5rem; text-align: center; }
.puzzle-opt { margin-bottom: 0.8rem; width: 100%; }
.puzzle-input { width: 100%; padding: 1rem; background: rgba(0,0,0,0.5); border: 1px solid var(--gold); color: var(--gold); font-family: 'Cinzel', serif; font-size: 1.1rem; margin-bottom: 1rem; text-align: center; text-transform: uppercase; }
.puzzle-input:focus { outline: none; border-color: #fff; box-shadow: 0 0 10px var(--gold); }
.puzzle-submit-btn { background: var(--gold-dark); color: #000; font-weight: bold; }
.sequence-display { font-size: 1.5rem; text-align: center; margin-bottom: 1rem; color: #fff; text-shadow: 0 0 10px var(--gold); }
.sequence-btns { display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; }
.dice-value { font-size: 4rem; text-align: center; color: var(--gold); font-family: 'Cinzel', serif; margin: 1rem 0; animation: pulse 1s infinite; }

@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.1); } 100% { transform: scale(1); } }

@media (max-width: 768px) {
  body { overflow: hidden; height: 100vh; height: 100dvh; background: #000; }

  /* ── GAME CONTAINER: full screen fixed ── */
  .pro-container {
    height: 100vh; height: 100dvh;
    width: 100vw;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    background: #000;
    position: relative;
  }

  /* ── BACKGROUND IMAGE: full screen behind everything ── */
  .background-art {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 55%;
    background-size: cover;
    background-position: center top;
    z-index: 1;
  }
  .background-blur {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-size: cover;
    background-position: center;
    filter: blur(20px) brightness(0.4);
    z-index: 0;
    display: block;
  }
  .vignette {
    display: block;
    background:
      linear-gradient(to bottom, transparent 30%, rgba(0,0,0,0.85) 100%);
  }

  /* ── STATUS DASHBOARD: compact strip at top ── */
  .status-dashboard {
    position: absolute;
    top: 8px; right: 8px;
    width: 160px;
    background: rgba(0,0,0,0.75);
    border: 1px solid var(--gold-dark);
    border-radius: 6px;
    padding: 8px;
    z-index: 30;
  }
  .act-label { font-size: 0.6rem; letter-spacing: 1px; padding-bottom: 5px; margin-bottom: 5px; }
  .status-item { margin-bottom: 6px; }
  .status-label { font-size: 0.6rem; margin-bottom: 2px; }
  .status-bar-container { height: 5px; }
  .status-bar { font-size: 0; } /* hide % text on mobile */
  .inventory-bar { margin-top: 6px; padding-top: 6px; }
  .inventory-slots { gap: 4px; margin-top: 3px; flex-wrap: wrap; }
  .inv-item { width: 28px; height: 28px; font-size: 0.9rem; }

  /* ── NAV CONTROL: top left ── */
  .nav-control {
    position: absolute;
    top: 8px; left: 8px;
    z-index: 30;
    display: flex;
    gap: 6px;
  }
  .map-btn { padding: 7px 10px; font-size: 0.75rem; }

  /* ── HEADER TITLE ── */
  .header-overlay { top: 8px; pointer-events: none; }
  .header-overlay h2 { font-size: 0.7rem; padding: 3px 10px; letter-spacing: 2px; }

  /* ── PORTRAIT: small, above the panel ── */
  .portrait-container {
    position: absolute;
    bottom: 42%;
    left: 12px;
    width: 70px;
    z-index: 15;
    display: block;
    transform: none;
    top: auto;
  }
  .portrait-img { border-width: 1px; }
  .portrait-name { font-size: 0.65rem; padding: 2px 5px; }

  /* ── HUD BOX: bottom panel, max 50% of screen ── */
  .hud-box {
    position: relative;
    width: 100%;
    padding: 0;
    bottom: 0;
    z-index: 20;
    max-height: 52vh;
    display: flex;
    flex-direction: column;
  }
  .parchment-sheet {
    padding: 0.9rem 1rem 1rem;
    border-left-width: 4px;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -8px 24px rgba(0,0,0,0.6);
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-height: 52vh;
  }
  .pro-text {
    font-size: 0.95rem;
    line-height: 1.45;
    margin-bottom: 0.6rem;
    flex-shrink: 0;
  }
  .pro-options {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    gap: 0.4rem;
  }
  .pro-option {
    padding: 0.65rem 0.9rem;
    font-size: 0.9rem;
    gap: 0.7rem;
    border-radius: 6px;
    flex-shrink: 0;
  }
  .pro-option:hover { transform: none; } /* disable slide on touch */

  /* ── TITLE SCREEN MOBILE ── */
  .title-content { flex-direction: column; align-items: center; gap: 0.5rem; padding: 1rem; padding-bottom: 4rem; }
  .hero-portrait { position: relative; height: 28vh; width: 100%; margin-bottom: -1rem; z-index: 5; }
  .hero-portrait img { height: 100%; width: 100%; object-fit: contain; }
  .title-text-block {
    padding: 1.2rem;
    background: rgba(0,0,0,0.82);
    text-align: center;
    width: 96%;
    border-radius: 12px;
    backdrop-filter: blur(8px);
  }
  .title-pretitle { font-size: 0.85rem; letter-spacing: 2px; }
  .title-main { font-size: 2rem; letter-spacing: 1px; line-height: 1.1; margin-bottom: 0.4rem; }
  .title-subtitle { font-size: 0.9rem; margin-bottom: 0.8rem; }
  .title-separator { display: none; }
  .how-to-play { padding: 0.8rem; margin-top: 0.8rem; }
  .how-to-play p { font-size: 0.85rem; }
  .title-actions { gap: 0.7rem; width: 100%; }
  .btn-primary, .btn-secondary { width: 100%; padding: 0.9rem; font-size: 0.95rem; }
  .title-footer { position: relative; flex-direction: column; gap: 4px; padding: 1.2rem 1rem; background: #000; border-top: 1px solid var(--gold-dark); font-size: 0.7rem; }

  /* ── OVERLAYS ── */
  .nav-menu { width: 95%; padding: 1.2rem; }
  .credits-body { width: 95%; padding: 1.5rem 1rem; }
  .nav-overlay { align-items: flex-end; padding-bottom: 0; }
  .nav-menu { border-radius: 12px 12px 0 0; }
}

@media (max-height: 500px) and (orientation: landscape) {
  .hero-portrait { display: none; }
  .title-content { padding-top: 0; }
  .title-main { font-size: 2.5rem; }
  .background-art { height: 100%; }
  .hud-box { max-height: 70vh; }
  .parchment-sheet { max-height: 70vh; }
}

/* ========================
   CINEMATIC VIDEO
   ======================== */

.cinematic-container {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  animation: fadeIn 1.5s ease;
}

.cinematic-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  box-shadow: 0 0 100px rgba(0,0,0,1);
}

.cinematic-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, transparent 60%, rgba(0,0,0,0.8) 100%);
  pointer-events: none;
}

.skip-cinematic {
  position: absolute;
  bottom: 40px;
  right: 40px;
  background: rgba(0,0,0,0.5);
  border: 1px solid var(--gold);
  color: var(--gold);
  padding: 10px 25px;
  font-family: var(--font-title);
  cursor: pointer;
  z-index: 2001;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.skip-cinematic:hover {
  background: var(--gold);
  color: #000;
}

/* ========================
   LOADING SCREEN
   ======================== */
.loading-screen {
  position: fixed;
  inset: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.6s ease;
}
.loading-screen.loading-fade-out {
  opacity: 0;
  pointer-events: none;
}
.loading-bg {
  position: absolute;
  inset: 0;
  background: url('/palacio_viso_epic.webp') center/cover no-repeat;
  filter: brightness(0.25) blur(8px);
}
.loading-content {
  position: relative;
  z-index: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: 2rem;
}
.loading-crest {
  width: 80px;
  filter: drop-shadow(0 0 20px rgba(197,160,33,0.6));
  animation: pulse 2s ease-in-out infinite;
}
.loading-title {
  font-family: var(--font-display);
  font-size: 2.5rem;
  color: var(--gold);
  line-height: 1;
  text-shadow: 0 0 30px rgba(197,160,33,0.4);
}
.loading-bar-wrap {
  width: 280px;
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  overflow: hidden;
}
.loading-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold));
  border-radius: 2px;
  transition: width 0.4s ease;
  box-shadow: 0 0 8px var(--gold);
}
.loading-text {
  font-family: var(--font-title);
  color: rgba(255,255,255,0.5);
  font-size: 0.9rem;
  letter-spacing: 3px;
  text-transform: uppercase;
}

/* ========================
   STAT BAR ANIMATIONS
   ======================== */
.stat-up {
  animation: statFlashGreen 0.8s ease forwards;
}
.stat-down {
  animation: statFlashRed 0.8s ease forwards;
}
@keyframes statFlashGreen {
  0%   { filter: brightness(1); }
  30%  { filter: brightness(2) drop-shadow(0 0 6px #4ade80); }
  100% { filter: brightness(1); }
}
@keyframes statFlashRed {
  0%   { filter: brightness(1); }
  30%  { filter: brightness(2) drop-shadow(0 0 6px #f87171); }
  100% { filter: brightness(1); }
}
.stat-delta {
  position: absolute;
  right: 0;
  top: -18px;
  font-family: var(--font-title);
  font-size: 0.85rem;
  font-weight: bold;
  pointer-events: none;
  animation: floatDelta 1.2s ease forwards;
}
.stat-delta.positive { color: #4ade80; }
.stat-delta.negative { color: #f87171; }
@keyframes floatDelta {
  0%   { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-24px); }
}
.status-item { position: relative; }

/* ========================
   ACT TRANSITION SCREEN
   ======================== */
.act-transition {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  cursor: pointer;
  animation: actFadeIn 0.8s ease forwards;
}
.act-transition-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: brightness(0.3) blur(4px);
  animation: kenBurns 8s ease-in-out forwards;
}
.act-transition-content {
  position: relative;
  z-index: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 2rem;
}
.act-transition-label {
  font-family: var(--font-title);
  color: rgba(197,160,33,0.7);
  font-size: 1rem;
  letter-spacing: 8px;
  text-transform: uppercase;
}
.act-transition-num {
  font-family: var(--font-display);
  font-size: clamp(5rem, 20vw, 10rem);
  color: var(--gold);
  line-height: 1;
  text-shadow: 0 0 60px rgba(197,160,33,0.5);
  animation: actNumPulse 3s ease-in-out infinite;
}
.act-transition-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 5vw, 3rem);
  color: #fff;
  letter-spacing: 4px;
  text-transform: uppercase;
  text-shadow: 0 2px 20px rgba(0,0,0,1);
}
.act-transition-sub {
  font-family: var(--font-title);
  font-size: clamp(0.8rem, 2vw, 1.1rem);
  color: rgba(255,255,255,0.5);
  letter-spacing: 3px;
  margin-top: 0.5rem;
}
.act-transition-skip {
  margin-top: 2rem;
  font-family: var(--font-title);
  color: rgba(255,255,255,0.3);
  font-size: 0.8rem;
  letter-spacing: 2px;
  animation: blink 2s ease infinite;
}
@keyframes actFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes actNumPulse {
  0%, 100% { text-shadow: 0 0 40px rgba(197,160,33,0.4); }
  50%       { text-shadow: 0 0 80px rgba(197,160,33,0.8); }
}
@keyframes blink {
  0%, 100% { opacity: 0.3; }
  50%       { opacity: 0.8; }
}
.act-transition-out {
  animation: actFadeOut 0.8s ease forwards !important;
}
@keyframes actFadeOut {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(1.05); }
}

/* ========================
   END STATS PANEL
   ======================== */
.end-stats {
  background: rgba(0,0,0,0.6);
  border: 1px solid var(--gold-dark);
  border-radius: 8px;
  padding: 1rem 1.2rem;
  margin-bottom: 0.8rem;
  text-align: center;
}
.end-stats-title {
  font-family: var(--font-title);
  color: var(--gold);
  font-size: 0.85rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 0.3rem;
}
.end-grade {
  font-family: var(--font-display);
  font-size: 3.5rem;
  line-height: 1;
  text-shadow: 0 0 30px currentColor;
}
.end-score {
  font-family: var(--font-title);
  color: rgba(255,255,255,0.6);
  font-size: 0.85rem;
  margin-bottom: 0.8rem;
}
.end-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  margin-bottom: 0.8rem;
}
.end-stat-item {
  background: rgba(255,255,255,0.05);
  border-radius: 4px;
  padding: 0.4rem 0.3rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.end-stat-label {
  font-family: var(--font-title);
  color: var(--gold);
  font-size: 0.6rem;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.end-stat-val {
  color: #fff;
  font-family: var(--font-title);
  font-size: 0.9rem;
  font-weight: bold;
}
.end-inventory {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 0.8rem;
  font-size: 1.3rem;
}
.end-share-btn {
  background: transparent;
  border: 1px solid var(--gold-dark);
  color: var(--gold);
  padding: 0.5rem 1.2rem;
  font-family: var(--font-title);
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: 4px;
  letter-spacing: 1px;
  transition: all 0.3s ease;
  width: 100%;
}
.end-share-btn:hover {
  background: var(--gold);
  color: #000;
}

/* ========================
   DIFFICULTY BUTTON
   ======================== */
.btn-difficulty {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.5);
  padding: 0.7rem 1.5rem;
  font-family: var(--font-title);
  font-size: 0.9rem;
  cursor: pointer;
  letter-spacing: 2px;
  transition: all 0.3s ease;
  width: 100%;
  border-radius: 4px;
}
.btn-difficulty:hover {
  border-color: var(--gold);
  color: var(--gold);
}
.btn-difficulty.hard-active {
  background: rgba(180, 30, 30, 0.3);
  border-color: #ef4444;
  color: #ef4444;
  text-shadow: 0 0 10px rgba(239,68,68,0.5);
}

/* ========================
   DIARIO DEL ALMIRANTE
   ======================== */
.diary-panel {
  max-width: 500px;
  width: 95%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.diary-panel h3 {
  font-family: var(--font-display);
  color: var(--accent);
  margin-bottom: 1rem;
  font-size: 1.2rem;
}
.diary-entries {
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding-right: 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--gold-dark) transparent;
}
.diary-entry {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  padding: 0.6rem 0.8rem;
  background: rgba(0,0,0,0.06);
  border-left: 3px solid var(--gold-dark);
  border-radius: 0 4px 4px 0;
  animation: fadeIn 0.4s ease;
}
.diary-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  margin-top: 1px;
}
.diary-text {
  font-family: var(--font-story);
  font-size: 0.95rem;
  color: var(--ink);
  line-height: 1.4;
}
