/* =========================================================
   AJOLOTE Y LA SERPIENTE DEL MANANTIAL
   Interfaz de cueva: musgo, oro viejo, agua luminosa.
   ========================================================= */
@font-face {
  font-family: "Cormorant Garamond";
  src: url("./fonts/cormorant-garamond-latin.woff2") format("woff2");
  font-weight: 500 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Silkscreen";
  src: url("./fonts/silkscreen-400-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Silkscreen";
  src: url("./fonts/silkscreen-700-latin.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Pixelify Sans";
  src: url("./fonts/pixelify-sans-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --night: #080e0d;
  --deep: #0b1614;
  --panel: rgba(8, 17, 15, 0.82);
  --panel-strong: rgba(7, 14, 13, 0.93);
  --ink: #1b1510;
  --cream: #efe5cf;
  --cream-soft: #cfc2a8;
  --gold: #c7a368;
  --gold-light: #f0d39a;
  --gold-dark: #7f6238;
  --moss: #7ba46a;
  --moss-bright: #b4da83;
  --glow: #79f3c6;
  --glow-soft: #48c8b1;
  --rose: #f19ab5;
  --rose-light: #ffd0dc;
  --danger: #d56d73;
  --focus: #f0cd60;
  --focus-hot: #ffe789;
  --bg-glow: rgba(95, 214, 173, 0.14);
  font-family: "Cormorant Garamond", Georgia, serif;
  color: var(--cream);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cream);
  background:
    radial-gradient(ellipse 70% 65% at 50% 45%, rgba(46, 95, 77, 0.18), transparent 70%),
    radial-gradient(ellipse at 50% 115%, #1a3028, transparent 55%),
    #050908;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  overscroll-behavior: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  background-image:
    repeating-linear-gradient(97deg, rgba(152, 210, 170, 0.025) 0 1px, transparent 1px 10px),
    repeating-linear-gradient(0deg, transparent 0 43px, rgba(0, 0, 0, 0.2) 43px 45px);
}

.stage {
  position: relative;
  width: min(100vw, 177.7778dvh);
  aspect-ratio: 16 / 9;
  max-height: 100dvh;
  overflow: hidden;
  container-type: size;
  isolation: isolate;
  background: #0b1412;
  box-shadow:
    0 0 0 1px rgba(194, 164, 110, 0.16),
    0 2.4vh 7vh rgba(0, 0, 0, 0.75);
  z-index: 1;
}

#scene {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.cave-vignette {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background:
    radial-gradient(ellipse 74% 68% at 50% 47%, transparent 50%, rgba(1, 6, 5, 0.38) 83%, rgba(1, 4, 3, 0.78) 100%),
    linear-gradient(90deg, rgba(2, 8, 7, 0.42), transparent 15%, transparent 84%, rgba(2, 6, 5, 0.46));
}

.screen-fx {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  opacity: 0.7;
  mix-blend-mode: multiply;
  background: repeating-linear-gradient(
    to bottom,
    rgba(4, 9, 7, 0.055) 0,
    rgba(4, 9, 7, 0.055) 1px,
    transparent 1px,
    transparent 3px
  );
}

/* =========================
   HUD DEL AJOLOTE
   ========================= */
.player-hud {
  position: absolute;
  top: 2.5cqw;
  left: 2.5cqw;
  z-index: 14;
  width: 25.8cqw;
  transition: opacity 500ms ease, transform 500ms ease;
}

.player-panel {
  position: relative;
  display: grid;
  grid-template-columns: 7.7cqw 1fr;
  grid-template-rows: auto auto;
  column-gap: 1cqw;
  row-gap: 0.7cqw;
  padding: 0.75cqw 0.9cqw 0.8cqw 0.75cqw;
  background:
    linear-gradient(180deg, rgba(18, 32, 27, 0.77), rgba(5, 13, 11, 0.9)),
    radial-gradient(ellipse at 15% 15%, rgba(121, 243, 198, 0.08), transparent 55%);
  border: 0.12cqw solid rgba(199, 163, 104, 0.57);
  border-radius: 0.2cqw;
  clip-path: polygon(0.55cqw 0, calc(100% - 1.1cqw) 0, 100% 0.65cqw, 100% calc(100% - 0.65cqw), calc(100% - 0.65cqw) 100%, 0.55cqw 100%, 0 calc(100% - 0.65cqw), 0 0.65cqw);
  box-shadow:
    0 0.9cqw 2.4cqw rgba(0, 0, 0, 0.35),
    inset 0 0 1.6cqw rgba(107, 200, 160, 0.04);
}

.player-panel::before,
.player-panel::after {
  content: "";
  position: absolute;
  pointer-events: none;
}
.player-panel::before {
  inset: 0.22cqw;
  border: 0.08cqw solid rgba(199, 163, 104, 0.16);
  clip-path: polygon(0.4cqw 0, calc(100% - 0.8cqw) 0, 100% 0.5cqw, 100% calc(100% - 0.5cqw), calc(100% - 0.5cqw) 100%, 0.4cqw 100%, 0 calc(100% - 0.5cqw), 0 0.5cqw);
}
.player-panel::after {
  left: 8.1cqw;
  right: 0.7cqw;
  top: 0.5cqw;
  height: 0.07cqw;
  background: linear-gradient(90deg, rgba(121, 243, 198, 0.3), transparent 80%);
}

.portrait-column {
  display: flex;
  flex-direction: column;
  gap: 0.45cqw;
}

.portrait-frame {
  position: relative;
  width: 7.7cqw;
  height: 7.7cqw;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #07110f;
  border: 0.16cqw solid rgba(220, 190, 130, 0.64);
  box-shadow:
    0 0 0 0.22cqw rgba(4, 11, 9, 0.85),
    0 0 0 0.31cqw rgba(79, 134, 104, 0.48),
    inset 0 0 1.3cqw rgba(0, 0, 0, 0.5);
}

.portrait-frame::before {
  content: "";
  position: absolute;
  inset: -0.55cqw;
  border-radius: 50%;
  border: 0.08cqw solid rgba(121, 243, 198, 0.13);
  pointer-events: none;
}

.portrait {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 50%;
  filter: saturate(1.03);
}

.portrait-name {
  position: absolute;
  left: 50%;
  bottom: -0.6cqw;
  transform: translateX(-50%);
  z-index: 2;
  padding: 0.12cqw 0.45cqw;
  background: #0a1512;
  border: 0.07cqw solid rgba(199, 163, 104, 0.55);
  color: var(--gold-light);
  font-family: "Silkscreen", monospace;
  font-size: 0.57cqw;
  letter-spacing: 0.09em;
  white-space: nowrap;
}

.arm-scar {
  position: absolute;
  top: 13%;
  right: 12%;
  width: 28%;
  height: 36%;
  background: linear-gradient(145deg, transparent 45%, rgba(197, 79, 96, 0.85) 46% 53%, transparent 54%);
  opacity: 0;
  transform: rotate(9deg);
  transition: opacity 250ms ease;
  filter: drop-shadow(0 0 2px rgba(202, 73, 88, 0.8));
}
.portrait-frame.arm-lost .arm-scar { opacity: 1; }

.focus-block {
  width: 100%;
  min-width: 0;
}

.focus-topline {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.3cqw;
  margin-bottom: 0.22cqw;
  font-family: "Silkscreen", monospace;
  font-size: 0.58cqw;
  letter-spacing: 0.035em;
  color: rgba(235, 222, 195, 0.75);
  white-space: nowrap;
}

.focus-hint {
  font-size: 0.5cqw;
  color: rgba(240, 205, 96, 0.72);
  letter-spacing: 0;
}

.focus-track {
  position: relative;
  width: 100%;
  height: 0.98cqw;
  overflow: hidden;
  background:
    repeating-linear-gradient(115deg, rgba(222, 190, 116, 0.06) 0 0.65cqw, transparent 0.65cqw 1.3cqw),
    linear-gradient(180deg, rgba(2, 8, 6, 0.95), rgba(16, 30, 24, 0.9));
  border: 0.1cqw solid rgba(199, 163, 104, 0.56);
  box-shadow: inset 0 0.12cqw 0.28cqw rgba(0, 0, 0, 0.8);
  clip-path: polygon(0 0, 100% 0, 100% 65%, 97% 100%, 0 100%);
}

.focus-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background:
    linear-gradient(180deg, rgba(255, 247, 184, 0.95), rgba(240, 205, 96, 0.84) 45%, rgba(186, 139, 55, 0.86));
  box-shadow:
    0 0 0.65cqw rgba(255, 221, 109, 0.5),
    0 0 1.4cqw rgba(255, 212, 90, 0.2);
  transition: width 100ms linear;
}

.focus-fill::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 0.18cqw;
  height: 100%;
  background: #fff6bf;
  box-shadow: 0 0 0.5cqw #ffe789;
}

.focus-glint {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.34;
  background: repeating-linear-gradient(90deg, transparent 0 1.4cqw, rgba(255, 247, 203, 0.3) 1.4cqw 1.48cqw);
}

.focus-track.is-ready {
  border-color: rgba(255, 224, 120, 0.72);
  animation: focus-breathe 2.1s ease-in-out infinite;
}

.focus-track.is-ready .focus-glint { opacity: 0.75; }

.bubble-column {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-left: 0.2cqw;
}

.bubble-label {
  margin-bottom: 0.3cqw;
  font-family: "Silkscreen", monospace;
  font-size: 0.6cqw;
  letter-spacing: 0.14em;
  color: rgba(232, 217, 188, 0.58);
}

.bubbles {
  display: flex;
  align-items: center;
  gap: 0.4cqw;
  height: 2.35cqw;
}

.bubble {
  position: relative;
  width: 1.62cqw;
  height: 1.62cqw;
  flex: 0 0 auto;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 27%, rgba(255, 255, 255, 0.9), transparent 20%),
    radial-gradient(circle at 45% 40%, #ffd1e2 0%, #eaa0bc 48%, #a85175 100%);
  border: 0.1cqw solid rgba(255, 213, 227, 0.82);
  box-shadow:
    0 0 0.3cqw rgba(241, 154, 181, 0.22),
    0 0.15cqw 0.3cqw rgba(0, 0, 0, 0.4),
    inset 0 -0.25cqw 0.3cqw rgba(104, 35, 62, 0.5);
  transition: opacity 120ms linear, filter 220ms ease, transform 220ms ease;
}

.bubble::after {
  content: "";
  position: absolute;
  inset: 22% 19% 42% 22%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.33);
  filter: blur(0.06cqw);
}

.bubble i {
  position: absolute;
  width: 0.27cqw;
  height: 0.27cqw;
  top: 18%;
  left: 22%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
}

.bubble.is-popping {
  animation: bubble-pop 420ms cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}

.bubble.is-popped {
  background: radial-gradient(circle at 50% 45%, rgba(80, 116, 101, 0.12), rgba(4, 12, 10, 0.52));
  border-color: rgba(153, 185, 162, 0.26);
  box-shadow: inset 0 0 0.35cqw rgba(0, 0, 0, 0.7);
  opacity: 0.48;
}

.bubble.is-popped::after,
.bubble.is-popped i { display: none; }

.bubble.is-restoring {
  animation: bubble-restore 560ms cubic-bezier(0.2, 1.2, 0.4, 1);
}

.bubble-caption {
  margin-top: 0.22cqw;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-size: 0.72cqw;
  line-height: 1;
  color: rgba(204, 189, 161, 0.48);
  white-space: nowrap;
}

.arm-warning {
  display: flex;
  align-items: center;
  gap: 0.4cqw;
  width: fit-content;
  margin-top: 0.45cqw;
  padding: 0.28cqw 0.55cqw;
  background: rgba(28, 12, 12, 0.82);
  border-left: 0.14cqw solid var(--danger);
  color: #e7b4ae;
  font-family: "Silkscreen", monospace;
  font-size: 0.53cqw;
  letter-spacing: 0.04em;
  text-shadow: 0 0 0.5cqw rgba(213, 109, 115, 0.5);
}

.arm-warning-dot {
  width: 0.37cqw;
  height: 0.37cqw;
  background: var(--danger);
  box-shadow: 0 0 0.45cqw var(--danger);
  border-radius: 50%;
}

/* =========================
   HUD DEL BOSS
   ========================= */
.boss-hud {
  position: absolute;
  top: 2.5cqw;
  right: 2.5cqw;
  z-index: 14;
  width: 34cqw;
  transition: opacity 500ms ease, transform 500ms ease;
}

.boss-hud::before {
  content: "";
  position: absolute;
  inset: -0.65cqw -0.8cqw -0.75cqw -0.8cqw;
  z-index: -1;
  background: radial-gradient(ellipse at 55% 20%, rgba(7, 17, 14, 0.72), transparent 76%);
  pointer-events: none;
}

.boss-omission {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35cqw;
  height: 0.75cqw;
  margin-bottom: 0.25cqw;
}
.boss-omission span {
  display: block;
  height: 0.08cqw;
  background: linear-gradient(90deg, transparent, rgba(199, 163, 104, 0.75));
}
.boss-omission span:first-child { width: 7cqw; }
.boss-omission span:last-child { width: 2.2cqw; }

.boss-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6cqw;
  font-family: "Silkscreen", monospace;
  font-size: 0.57cqw;
  letter-spacing: 0.11em;
  color: rgba(211, 194, 159, 0.68);
}

.boss-phase {
  color: var(--moss-bright);
  letter-spacing: 0.06em;
  transition: color 220ms ease, text-shadow 220ms ease;
}
.boss-phase.is-phase-two {
  color: #f2b075;
  text-shadow: 0 0 0.8cqw rgba(246, 156, 89, 0.7);
}

.boss-name {
  margin: 0.18cqw 0 0.35cqw;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 600;
  font-size: 2cqw;
  line-height: 0.96;
  letter-spacing: 0.015em;
  color: #eadfc8;
  text-align: right;
  text-shadow: 0 0.18cqw 0.8cqw rgba(0, 0, 0, 0.6);
}

.boss-bar {
  position: relative;
  width: 100%;
  height: 1.08cqw;
  overflow: hidden;
  background: linear-gradient(180deg, #0b1210, #1c2621);
  border: 0.1cqw solid rgba(199, 163, 104, 0.58);
  box-shadow:
    0 0.15cqw 0.8cqw rgba(0, 0, 0, 0.52),
    inset 0 0.1cqw 0.2cqw rgba(0, 0, 0, 0.8);
  clip-path: polygon(0.4cqw 0, 100% 0, 100% 100%, 0 100%, 0 0.4cqw);
}

.boss-trail,
.boss-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 100%;
  height: 100%;
  transition: width 120ms linear;
}

.boss-trail {
  background: linear-gradient(90deg, rgba(151, 78, 64, 0.28), rgba(207, 119, 92, 0.62));
  transition: width 800ms cubic-bezier(0.2, 0.8, 0.3, 1) 120ms;
}

.boss-fill {
  background:
    linear-gradient(180deg, rgba(217, 245, 173, 0.86) 0%, rgba(141, 188, 104, 0.9) 36%, rgba(62, 112, 71, 0.92) 100%);
  box-shadow:
    inset 0 -0.25cqw 0 rgba(13, 45, 36, 0.42),
    inset 0 0.08cqw 0 rgba(255, 255, 225, 0.55);
  transition: width 120ms linear;
}

.boss-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(115deg, transparent 0 2.6cqw, rgba(6, 21, 17, 0.16) 2.6cqw 2.8cqw);
  opacity: 0.55;
}

.boss-bar-glint {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 224, 0.2), transparent 47%);
}

.boss-ticks {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: space-evenly;
  pointer-events: none;
}
.boss-ticks span {
  width: 0.08cqw;
  height: 100%;
  background: rgba(4, 11, 8, 0.38);
  box-shadow: 0.1cqw 0 0 rgba(224, 204, 158, 0.12);
}

.boss-undernote {
  display: flex;
  justify-content: space-between;
  gap: 1cqw;
  margin-top: 0.4cqw;
  font-family: "Silkscreen", monospace;
  font-size: 0.54cqw;
  letter-spacing: 0.065em;
  color: rgba(217, 198, 163, 0.68);
  text-shadow: 0 0.1cqw 0.4cqw rgba(0, 0, 0, 0.6);
}

.boss-hud.is-enraged .boss-fill {
  background: linear-gradient(180deg, #ffd69a, #e69864 36%, #914a4b 100%);
  box-shadow: 0 0 0.7cqw rgba(242, 151, 92, 0.38), inset 0 0.08cqw 0 rgba(255, 245, 218, 0.5);
}

.boss-hud.is-enraged .boss-name {
  color: #f6d1b0;
}

/* =========================
   UTILIDADES Y CONTROLES
   ========================= */
.utility-dock {
  position: absolute;
  right: 2.5cqw;
  bottom: 2.3cqw;
  z-index: 16;
  display: flex;
  align-items: center;
  gap: 0.55cqw;
  opacity: 0;
  transform: translateY(0.5cqw);
  pointer-events: none;
  transition: opacity 500ms ease, transform 500ms ease;
}

.stage.is-playing .utility-dock,
.stage.is-ended .utility-dock {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.icon-btn,
.install-btn,
.ghost-btn,
.primary-btn {
  font-family: "Cormorant Garamond", Georgia, serif;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 2.55cqw;
  height: 2.55cqw;
  padding: 0;
  color: rgba(226, 214, 188, 0.76);
  background: rgba(6, 16, 13, 0.7);
  border: 0.1cqw solid rgba(199, 163, 104, 0.33);
  border-radius: 50%;
  box-shadow: inset 0 0 0.4cqw rgba(0, 0, 0, 0.3);
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}
.icon-btn:hover {
  color: var(--gold-light);
  border-color: rgba(224, 193, 131, 0.68);
  background: rgba(18, 38, 30, 0.88);
}
.icon-btn svg { width: 1.38cqw; height: 1.38cqw; }
.icon-off { display: none; }
.icon-btn[aria-pressed="false"] svg { opacity: 0.46; }

.install-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35cqw;
  height: 2.55cqw;
  padding: 0 0.78cqw;
  color: rgba(226, 214, 188, 0.78);
  background: rgba(6, 16, 13, 0.7);
  border: 0.1cqw solid rgba(199, 163, 104, 0.33);
  border-radius: 2cqw;
  font-family: "Silkscreen", monospace;
  font-size: 0.53cqw;
  letter-spacing: 0.03em;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}
.install-btn svg { width: 1.1cqw; height: 1.1cqw; }
.install-btn:hover {
  color: var(--gold-light);
  border-color: rgba(224, 193, 131, 0.68);
  background: rgba(18, 38, 30, 0.88);
}

.icon-btn:focus-visible,
.install-btn:focus-visible,
.primary-btn:focus-visible,
.ghost-btn:focus-visible,
.dialog-x:focus-visible {
  outline: 0.14cqw solid var(--glow);
  outline-offset: 0.2cqw;
}

.controls-hint {
  position: absolute;
  left: 50%;
  bottom: 2.1cqw;
  z-index: 13;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.8cqw;
  padding: 0.5cqw 1.1cqw;
  color: rgba(229, 217, 192, 0.8);
  background: linear-gradient(180deg, rgba(5, 14, 12, 0.8), rgba(4, 10, 9, 0.88));
  border: 0.08cqw solid rgba(199, 163, 104, 0.28);
  border-radius: 2cqw;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 0.86cqw;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 600ms ease, transform 600ms ease;
}
.stage.is-playing .controls-hint {
  opacity: 0.95;
  transform: translateX(-50%) translateY(0);
}
.stage.is-playing .controls-hint.is-dim { opacity: 0.4; }
.controls-hint em {
  color: var(--gold-light);
  font-style: normal;
  font-size: 0.68cqw;
  opacity: 0.6;
}
.controls-hint .divider {
  width: 0.08cqw;
  height: 0.75cqw;
  background: rgba(199, 163, 104, 0.25);
}
.controls-hint span {
  display: inline-flex;
  align-items: center;
  gap: 0.28cqw;
}

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 1.15cqw;
  height: 1.15cqw;
  padding: 0 0.23cqw;
  color: #e9dfc9;
  background: linear-gradient(180deg, rgba(53, 68, 53, 0.6), rgba(12, 25, 19, 0.85));
  border: 0.08cqw solid rgba(199, 163, 104, 0.44);
  border-bottom-color: rgba(2, 8, 6, 0.8);
  border-radius: 0.13cqw;
  font-family: "Silkscreen", monospace;
  font-size: 0.48cqw;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 0.1cqw 0 rgba(0, 0, 0, 0.4);
}

/* =========================
   TÍTULO
   ========================= */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 2cqw;
  background:
    radial-gradient(ellipse 60% 72% at 50% 48%, rgba(4, 11, 9, 0.78) 0%, rgba(3, 9, 7, 0.45) 45%, rgba(1, 4, 3, 0.6) 100%);
  backdrop-filter: blur(1.4px);
  transition: opacity 900ms ease, visibility 900ms ease;
}

.overlay[hidden] { display: none !important; }
.overlay.is-leaving {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.title-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 71cqw;
  text-align: center;
  padding: 1cqw 3cqw 1.2cqw;
  animation: title-rise 1.4s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

.title-card::before {
  content: "";
  position: absolute;
  inset: -3cqw -7cqw;
  z-index: -1;
  background:
    radial-gradient(ellipse 50% 48% at 50% 46%, rgba(6, 15, 12, 0.66), transparent 70%),
    radial-gradient(ellipse 36% 32% at 50% 52%, rgba(61, 124, 92, 0.1), transparent 70%);
  pointer-events: none;
}

.title-rune {
  display: flex;
  align-items: center;
  gap: 0.7cqw;
  margin-bottom: 0.3cqw;
  opacity: 0.64;
}
.title-rune span {
  width: 1.7cqw;
  height: 0.07cqw;
  background: linear-gradient(90deg, transparent, var(--gold));
}
.title-rune span:last-child { transform: rotate(180deg); }
.title-rune i {
  width: 0.7cqw;
  height: 0.7cqw;
  border: 0.09cqw solid var(--gold);
  transform: rotate(45deg);
  box-shadow: inset 0 0 0.35cqw rgba(121, 243, 198, 0.25);
}

.title-kicker {
  margin: 0 0 0.5cqw;
  font-family: "Silkscreen", monospace;
  font-size: 0.66cqw;
  letter-spacing: 0.28em;
  color: rgba(184, 211, 161, 0.82);
  text-shadow: 0 0 0.8cqw rgba(121, 243, 198, 0.2);
}

.title-card h1 {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 600;
  font-size: 7.4cqw;
  line-height: 0.78;
  letter-spacing: 0.08em;
  color: #f2e7d2;
  text-shadow:
    0 0.35cqw 0 rgba(4, 10, 8, 0.48),
    0 0 2.5cqw rgba(108, 229, 184, 0.16);
}

.title-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8cqw;
  width: 38cqw;
  margin: 0.65cqw 0 0.25cqw;
  opacity: 0.68;
}
.title-divider span {
  height: 0.07cqw;
  flex: 1;
  background: linear-gradient(90deg, transparent, var(--gold));
}
.title-divider span:last-child { transform: rotate(180deg); }
.title-divider i {
  width: 0.55cqw;
  height: 0.55cqw;
  background: var(--gold);
  transform: rotate(45deg);
}

.title-subtitle {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 2.25cqw;
  line-height: 1;
  letter-spacing: 0.04em;
  color: #cbbd9f;
  font-weight: 500;
}
.title-subtitle em {
  font-style: italic;
  color: var(--gold-light);
  font-weight: 600;
}

.title-lede {
  margin: 1.35cqw 0 1.4cqw;
  font-size: 1.18cqw;
  line-height: 1.45;
  color: rgba(216, 207, 185, 0.66);
  letter-spacing: 0.02em;
}

.primary-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75cqw;
  min-width: 18cqw;
  padding: 0.72cqw 1.65cqw;
  color: #192013;
  background:
    linear-gradient(180deg, rgba(255, 241, 193, 0.96), rgba(202, 168, 94, 0.96) 52%, rgba(139, 104, 51, 0.98));
  border: 0.1cqw solid rgba(255, 235, 170, 0.86);
  box-shadow:
    0 0.25cqw 0 rgba(19, 26, 17, 0.75),
    0 0 1.3cqw rgba(195, 224, 132, 0.2),
    inset 0 0.12cqw 0 rgba(255, 255, 230, 0.55);
  clip-path: polygon(0.55cqw 0, 100% 0, 100% calc(100% - 0.55cqw), calc(100% - 0.55cqw) 100%, 0 100%, 0 0.55cqw);
  font-family: "Silkscreen", monospace;
  font-size: 0.77cqw;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: filter 170ms ease, transform 170ms ease, box-shadow 170ms ease;
}
.primary-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-0.1cqw);
  box-shadow:
    0 0.35cqw 0 rgba(19, 26, 17, 0.75),
    0 0 1.8cqw rgba(195, 224, 132, 0.32),
    inset 0 0.12cqw 0 rgba(255, 255, 230, 0.55);
}
.primary-btn:active { transform: translateY(0.1cqw); }
.primary-btn svg { width: 1.2cqw; height: 1.2cqw; }
.primary-btn.compact {
  min-width: 0;
  padding: 0.55rem 0.9rem;
  font-size: 0.64rem;
}

.ghost-btn {
  appearance: none;
  border: 0;
  padding: 0.6cqw 0.3cqw 0.25cqw;
  color: rgba(213, 199, 168, 0.55);
  background: transparent;
  font-family: "Silkscreen", monospace;
  font-size: 0.5cqw;
  letter-spacing: 0.08em;
  text-decoration: underline;
  text-decoration-color: rgba(199, 163, 104, 0.25);
  text-underline-offset: 0.25cqw;
  cursor: pointer;
  transition: color 160ms ease;
}
.ghost-btn:hover { color: var(--gold-light); }

.title-controls {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.55cqw;
  width: min(57cqw, 100%);
  margin-top: 1.3cqw;
  padding-top: 1.05cqw;
  border-top: 0.07cqw solid rgba(199, 163, 104, 0.24);
}

.title-controls > div {
  display: flex;
  flex-direction: column;
  gap: 0.35cqw;
  align-items: center;
  color: rgba(211, 198, 170, 0.54);
  font-size: 0.88cqw;
  line-height: 1.1;
}
.title-controls > div b {
  font-weight: 500;
  letter-spacing: 0.02em;
}
.title-controls > div span {
  display: flex;
  gap: 0.2cqw;
}
.title-controls .key-note,
.title-controls kbd {
  font-size: 0.48cqw;
}

.title-foot {
  margin: 1.1cqw 0 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-size: 0.9cqw;
  color: rgba(183, 210, 163, 0.55);
}

/* =========================
   FIN DE PARTIDA
   ========================= */
.end-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(54cqw, 100%);
  padding: 1.6cqw 3.2cqw;
  text-align: center;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(74, 129, 97, 0.16), transparent 68%),
    rgba(5, 13, 11, 0.88);
  border: 0.1cqw solid rgba(199, 163, 104, 0.34);
  box-shadow: 0 2cqw 6cqw rgba(0, 0, 0, 0.5);
  clip-path: polygon(0.7cqw 0, calc(100% - 0.7cqw) 0, 100% 0.7cqw, 100% calc(100% - 0.7cqw), calc(100% - 0.7cqw) 100%, 0.7cqw 100%, 0 calc(100% - 0.7cqw), 0 0.7cqw);
  animation: end-rise 700ms ease both;
}
.end-card h2 {
  margin: 0.2cqw 0 0.5cqw;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 600;
  font-size: 4cqw;
  line-height: 0.95;
  color: var(--cream);
  text-shadow: 0 0 2cqw rgba(123, 217, 179, 0.16);
}
.end-card > p:not(.title-kicker) {
  margin: 0 0 1.2cqw;
  max-width: 34cqw;
  font-size: 1.1cqw;
  line-height: 1.45;
  color: rgba(216, 206, 185, 0.68);
}
.end-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 100%;
  margin: 0 0 1.2cqw;
  border-top: 0.07cqw solid rgba(199, 163, 104, 0.22);
  border-bottom: 0.07cqw solid rgba(199, 163, 104, 0.22);
}
.end-stats > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25cqw;
  padding: 0.7cqw 0.8cqw;
}
.end-stats > div + div { border-left: 0.07cqw solid rgba(199, 163, 104, 0.16); }
.end-stats span {
  font-family: "Silkscreen", monospace;
  font-size: 0.48cqw;
  letter-spacing: 0.07em;
  color: rgba(207, 188, 152, 0.47);
}
.end-stats b {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.45cqw;
  font-weight: 600;
  color: var(--gold-light);
}
.end-card .primary-btn { min-width: 15cqw; }
.end-card .key {
  margin-left: 0.45cqw;
  padding: 0.12cqw 0.3cqw;
  border: 0.07cqw solid rgba(25, 32, 19, 0.45);
  font-family: "Silkscreen", monospace;
  font-size: 0.52cqw;
}
.end-card .ghost-btn { margin-top: 0.2cqw; }

/* =========================
   ANUNCIO DE FASE / TOAST
   ========================= */
.phase-banner {
  position: absolute;
  top: 15%;
  left: 50%;
  z-index: 18;
  display: flex;
  align-items: center;
  gap: 1.1cqw;
  transform: translate(-50%, -0.5cqw);
  opacity: 0;
  pointer-events: none;
  color: #e8d8b7;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 600;
  font-size: 2.2cqw;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-shadow:
    0 0.25cqw 0 rgba(4, 11, 8, 0.8),
    0 0 2cqw rgba(171, 230, 154, 0.18);
  transition: opacity 280ms ease, transform 450ms ease;
}
.phase-banner.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.phase-banner .phase-line {
  width: 4.5cqw;
  height: 0.07cqw;
  background: linear-gradient(90deg, transparent, var(--gold));
}
.phase-banner .phase-line:last-child { transform: rotate(180deg); }
.phase-banner.is-danger {
  color: #f1c49a;
  text-shadow: 0 0 2.2cqw rgba(246, 139, 89, 0.36);
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 6.6cqw;
  z-index: 19;
  max-width: 48cqw;
  padding: 0.55cqw 1.2cqw;
  color: rgba(241, 230, 209, 0.9);
  background: rgba(5, 14, 11, 0.88);
  border: 0.08cqw solid rgba(199, 163, 104, 0.32);
  border-radius: 0.18cqw;
  font-size: 0.98cqw;
  line-height: 1.25;
  letter-spacing: 0.03em;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 0.4cqw);
  transition: opacity 220ms ease, transform 250ms ease;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.warn {
  color: #f0c0b5;
  border-color: rgba(206, 102, 102, 0.4);
  background: rgba(25, 10, 9, 0.9);
}
.toast.heal {
  color: #e6f5b8;
  border-color: rgba(174, 211, 121, 0.38);
  background: rgba(10, 23, 12, 0.9);
}

/* =========================
   DIÁLOGO DE INSTALACIÓN
   ========================= */
.install-dialog {
  width: min(92vw, 560px);
  max-width: 560px;
  padding: 0;
  color: var(--cream);
  background: #0d1b17;
  border: 1px solid rgba(199, 163, 104, 0.5);
  border-radius: 3px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.68), 0 0 3rem rgba(79, 197, 155, 0.08);
}
.install-dialog::backdrop {
  background: rgba(2, 7, 5, 0.76);
  backdrop-filter: blur(4px);
}
.install-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 0 10px 0 18px;
  color: var(--gold-light);
  background: linear-gradient(90deg, rgba(27, 50, 39, 0.94), rgba(9, 23, 18, 0.98));
  border-bottom: 1px solid rgba(199, 163, 104, 0.35);
  font-family: "Silkscreen", monospace;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
}
.dialog-x {
  width: 30px;
  height: 30px;
  color: var(--cream);
  background: rgba(86, 38, 38, 0.65);
  border: 1px solid rgba(218, 143, 125, 0.4);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}
.install-body {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 20px;
  padding: 22px;
}
.install-art {
  width: 100px;
  height: 100px;
  align-self: start;
  border: 1px solid rgba(199, 163, 104, 0.45);
  background: #07110e;
}
.install-art svg { width: 100%; height: 100%; display: block; }
.install-copy h2 {
  margin: 0 0 8px;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 600;
  font-size: 1.55rem;
  line-height: 1;
  color: var(--gold-light);
}
.install-copy p {
  margin: 0 0 12px;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.04rem;
  line-height: 1.35;
  color: rgba(224, 212, 187, 0.73);
}
.install-copy b { color: #f2dfb4; }
.install-copy ol {
  margin: 0 0 12px;
  padding-left: 18px;
  font-size: 1rem;
  line-height: 1.4;
  color: rgba(224, 212, 187, 0.73);
}
.install-copy li { margin-bottom: 4px; }
.install-note { font-size: 0.9rem !important; color: rgba(176, 201, 161, 0.62) !important; }
.install-copy .primary-btn.compact { margin-top: 2px; }

/* =========================
   UTILIDADES
   ========================= */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.noscript {
  position: fixed;
  inset: auto 0 1rem;
  z-index: 60;
  margin: 0 auto;
  color: var(--cream);
  text-align: center;
}

.stage.is-title .player-hud,
.stage.is-title .boss-hud,
.stage.is-title .controls-hint { opacity: 0; }
.stage.is-title .boss-hud,
.stage.is-title .player-hud { transform: translateY(-0.8cqw); }

/* =========================
   ANIMACIONES
   ========================= */
@keyframes focus-breathe {
  0%, 100% { box-shadow: inset 0 0.12cqw 0.28cqw rgba(0, 0, 0, 0.8), 0 0 0.35cqw rgba(255, 223, 114, 0.1); }
  50% { box-shadow: inset 0 0.12cqw 0.28cqw rgba(0, 0, 0, 0.8), 0 0 0.65cqw rgba(255, 223, 114, 0.26); }
}

@keyframes bubble-pop {
  0% { transform: scale(1); filter: brightness(1); }
  26% { transform: scale(1.32); filter: brightness(1.7); }
  60% { transform: scale(0.72); opacity: 0.75; filter: brightness(1.35); }
  100% { transform: scale(0.3); opacity: 0; filter: brightness(1.6); }
}

@keyframes bubble-restore {
  0% { transform: scale(0.25); opacity: 0.2; filter: brightness(1.9); }
  50% { transform: scale(1.22); opacity: 1; filter: brightness(1.4); }
  100% { transform: scale(1); opacity: 1; filter: brightness(1); }
}

@keyframes title-rise {
  from { opacity: 0; transform: translateY(1.2cqw); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes end-rise {
  from { opacity: 0; transform: translateY(0.8cqw) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 720px) {
  .install-btn span { display: none; }
  .install-btn { width: 2.55cqw; padding: 0; justify-content: center; }
  .controls-hint .divider { display: none; }
  .controls-hint { gap: 0.5cqw; }
  .install-body { grid-template-columns: 1fr; }
  .install-art { display: none; }
}

@media (orientation: portrait) and (max-width: 820px) {
  .title-card h1 { font-size: 10cqw; }
  .title-kicker { font-size: 1.1cqw; }
  .title-subtitle { font-size: 3.2cqw; }
  .title-lede { font-size: 1.8cqw; }
  .primary-btn { font-size: 1.2cqw; min-width: 30cqw; padding: 1.2cqw 2cqw; }
  .ghost-btn { font-size: 1cqw; }
  .title-controls { grid-template-columns: repeat(3, 1fr); width: 80cqw; gap: 1.2cqw; }
  .title-controls > div { font-size: 1.4cqw; }
  .player-hud { width: 41cqw; }
  .player-panel { grid-template-columns: 13cqw 1fr; padding: 1.2cqw; }
  .portrait-frame { width: 13cqw; height: 13cqw; }
  .focus-topline { font-size: 1.05cqw; }
  .focus-hint { font-size: 0.9cqw; }
  .focus-track { height: 1.4cqw; }
  .bubble { width: 2.8cqw; height: 2.8cqw; }
  .bubbles { gap: 0.7cqw; height: 4cqw; }
  .bubble-label { font-size: 1cqw; }
  .bubble-caption { font-size: 1.1cqw; }
  .boss-hud { width: 50cqw; }
  .boss-name { font-size: 3.1cqw; }
  .boss-topline { font-size: 0.95cqw; }
  .boss-undernote { font-size: 0.8cqw; }
  .controls-hint { display: none; }
  .utility-dock { display: none; }
  .phase-banner { font-size: 3.2cqw; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .title-card { opacity: 1; transform: none; }
}
