/* Sharkie — adaptación de Ingenio con Aguilar. Escenario fijo de 1920×1080 que se escala por JS (touch.js). */
@font-face {
  font-family: 'Outfit';
  src: url('_shared/fonts/outfit-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --vino: #5b1c32;
  --guinda: #8a1f3d;
  --borgona: #a83250;
  --noche: #2a0d17;
  --oro: #d4af7c;
  --marfil: #faf8f7;
}

* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  overflow: hidden;
  color: var(--marfil);
  font-family: 'Outfit', system-ui, sans-serif;
  background: radial-gradient(120% 90% at 50% 0%, #4a1629 0%, var(--noche) 70%);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

.absolute {
  position: absolute;
  z-index: 1;
}
.hide {
  display: none !important;
}
.center {
  display: flex;
  align-items: center;
  justify-content: center;
}
.column {
  display: flex;
  flex-direction: column;
}
.row {
  display: flex;
  flex-direction: row;
}
.icon {
  height: 100px;
}

/* ---------- barra superior ---------- */
.dtop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(12px, 3vw, 28px);
  background: linear-gradient(100deg, #2a0d17, #5b1c32);
  box-shadow: 0 6px 24px rgba(42, 13, 23, 0.35);
}
.dtop a {
  color: var(--marfil);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}
.dtop__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}
.dtop__brand span {
  font-size: 15px;
}
.dtop nav {
  display: flex;
  gap: 8px;
}
.dtop nav a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(250, 248, 247, 0.28);
}
.dtop nav a:hover {
  background: rgba(250, 248, 247, 0.12);
}
html.embed .dtop {
  display: none;
}
@media (max-width: 520px) {
  .dtop__brand span {
    display: none;
  }
}

/* ---------- escenario escalable ---------- */
#stage-wrap {
  position: fixed;
  left: 0;
  right: 0;
  top: 52px;
  bottom: 0;
  overflow: hidden;
}
#stage {
  position: absolute;
  left: 0;
  top: 0;
  width: 1920px;
  height: 1080px;
  transform-origin: 0 0;
  border-radius: 18px;
  overflow: hidden;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(212, 175, 124, 0.25);
}
#game-container {
  background: #000;
  position: relative;
  overflow: hidden;
  width: 1920px;
  height: 1080px;
}
canvas {
  display: block;
  position: relative;
  width: 1920px;
  height: 1080px;
}

/* ---------- botones ---------- */
.button {
  width: 240px;
  height: 58px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--marfil);
  background: linear-gradient(180deg, var(--borgona), var(--guinda));
  border-radius: 14px;
  border: 1px solid rgba(212, 175, 124, 0.45);
  box-shadow:
    0 6px 0 var(--vino),
    0 14px 24px rgba(0, 0, 0, 0.35);
  text-shadow: 0 2px 2px rgba(42, 13, 23, 0.6);
  position: relative;
  bottom: 0;
  transition: 0.12s;
  cursor: pointer;
  text-align: center;
}
.button:hover {
  bottom: -4px;
  box-shadow:
    0 2px 0 var(--vino),
    0 8px 16px rgba(0, 0, 0, 0.3);
  filter: brightness(1.08);
}
.button:focus-visible,
.menu-button:focus-visible {
  outline: 3px solid var(--oro);
  outline-offset: 3px;
}

/* ---------- pantalla de inicio ---------- */
#opening-screen {
  background:
    linear-gradient(180deg, rgba(42, 13, 23, 0.55), rgba(42, 13, 23, 0.2) 40%, rgba(42, 13, 23, 0.65)),
    url('assets/ui-images/menu.webp') center/cover;
  height: 100%;
  width: 100%;
  z-index: 99;
}
#opening-header {
  color: var(--marfil);
  font-size: 190px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 6px;
  animation: breathing 5s ease-in-out infinite;
  text-shadow:
    1px 1px var(--oro),
    2px 2px var(--oro),
    3px 3px var(--oro),
    5px 5px var(--borgona),
    6px 6px var(--borgona),
    7px 7px var(--guinda),
    8px 8px var(--guinda),
    10px 10px var(--vino),
    0 0 30px rgba(0, 0, 0, 0.55);
}
#opening-tag {
  font-size: 30px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--oro);
  margin-bottom: 90px;
  font-weight: 600;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}
#opening-sharkie {
  height: 280px;
  transform: translateX(-300px) translateY(-190px) rotate(30deg);
  z-index: -1;
}
#play-button {
  height: 72px;
  width: 300px;
  font-size: 34px;
}
#opening-credit {
  bottom: 22px;
  left: 0;
  right: 0;
  margin: 0 auto;
  max-width: 1300px;
  text-align: center;
  font-size: 22px;
  line-height: 1.5;
  color: rgba(250, 248, 247, 0.78);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
}
#opening-credit a {
  color: var(--oro);
}
@keyframes breathing {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(0.97);
  }
}

/* ---------- diálogos ---------- */
#tutorial-container {
  height: 100%;
  width: 100%;
  background: rgba(20, 6, 12, 0.5);
}
.tutorial-dialog-container {
  height: 460px;
  width: 680px;
  background: linear-gradient(160deg, #3b1224, var(--noche));
  border: 1px solid rgba(212, 175, 124, 0.35);
  border-radius: 24px;
  padding: 22px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45);
  justify-content: space-between;
}
#quest-dialog-container {
  justify-content: space-between;
  font-size: 24px;
  text-align: center;
  line-height: 1.4;
}
#quest-dialog-container span {
  margin: 0 70px;
}
#quest-dialog-container img {
  height: 190px;
  background: rgba(250, 248, 247, 0.06);
  width: 100%;
  object-fit: contain;
  border-radius: 18px;
  padding: 10px 0;
}
.controls-key {
  background: rgba(250, 248, 247, 0.08);
  border-radius: 16px;
  padding: 12px 18px;
  width: max-content;
  min-width: 60px;
  font-size: 26px;
  line-height: 1;
  font-weight: 700;
  border: 2px solid rgba(212, 175, 124, 0.5);
  margin: 0 auto 10px;
  color: var(--marfil);
}
td {
  width: 50%;
  padding-bottom: 10px;
}
table {
  width: 100%;
}
#controls-move-container {
  margin: 0 auto;
  width: 180px;
}
#controls-jump-container {
  margin: 0 auto;
  width: 280px;
}
#controls-space {
  width: 140px;
  font-size: 18px;
}
#controls-jump-container,
#controls-move-container {
  gap: 12px;
}
.controls-label {
  font-size: 24px;
}
#controls-ok-button {
  margin: 0 auto;
}
#controls-touch-hint {
  text-align: center;
  margin: 0 0 10px;
  font-size: 20px;
  color: var(--oro);
}

/* ---------- HUD ---------- */
#ingame-top-right {
  display: flex;
  align-items: flex-end;
  right: 0;
  padding: 18px;
}
#ingame-menu {
  right: 0;
  margin-bottom: 10px;
}
.menu-button {
  height: 46px;
  width: 46px;
  background: linear-gradient(180deg, var(--borgona), var(--guinda));
  border: 1px solid rgba(212, 175, 124, 0.5);
  border-radius: 13px;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.3);
  margin-left: 14px;
  transition: 100ms;
}
.menu-button:hover {
  transform: scale(1.1);
}
.menu-button img {
  height: 28px;
}
.amount-container {
  background: rgba(42, 13, 23, 0.55);
  border: 1px solid rgba(212, 175, 124, 0.3);
  backdrop-filter: blur(6px);
  top: 3vh;
  right: 45px;
  height: 46px;
  width: 190px;
  border-radius: 40px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  font-weight: 700;
  color: var(--marfil);
  font-size: 26px;
  padding-right: 84px;
  margin: 20px 0;
  margin-right: 10px;
}
.amount-container img {
  right: -10px;
  height: 88px;
}
.unlocked-poison {
  background: rgba(65, 224, 65, 0.4);
  color: white;
}
.health-bar-container {
  background: rgba(250, 248, 247, 0.9);
  height: 34px;
  border-radius: 40px;
  border: var(--marfil) solid 3px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}
.health-bar {
  width: 100%;
  height: 100%;
  border-radius: 40px;
  background: linear-gradient(#b5ff2b, #82c900);
  border: var(--marfil) solid 3px;
  top: -3px;
  position: absolute;
  transition: 300ms;
}
#health-bar-container {
  top: 26px;
  left: 56px;
  width: 320px;
}
#health-icon {
  top: -45px;
  left: -50px;
}
#final-boss-health-bar-container {
  height: 26px;
  bottom: 34px;
  left: 0;
  right: 0;
  margin-left: auto;
  margin-right: auto;
  width: 560px;
}
#final-boss-health-icon {
  top: -32px;
  left: -53px;
  border: 3px var(--marfil) solid;
  border-radius: 50%;
  height: 70px;
}

/* ---------- resultado ---------- */
#win-container,
#dead-container {
  height: 100%;
  width: 100%;
  background: radial-gradient(circle at 50% 40%, rgba(91, 28, 50, 0.78), rgba(20, 6, 12, 0.9));
}
#win-label,
#dead-label {
  color: var(--marfil);
  font-size: 120px;
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
  text-shadow:
    0 4px 0 var(--guinda),
    0 8px 0 var(--vino),
    0 0 30px rgba(0, 0, 0, 0.5);
}
#dead-label {
  margin-bottom: 120px;
}
#win-sharkie {
  height: 270px;
  transform: translateX(-330px) translateY(50px);
}
#win-collected-coins-container {
  margin: 50px;
  padding: 4px 22px 4px 26px;
  background: rgba(250, 248, 247, 0.1);
  border: 1px solid rgba(212, 175, 124, 0.35);
  border-radius: 30px;
  font-size: 26px;
}
#win-collected-coins-container img {
  height: 56px;
}
#dead-sharkie {
  height: 130px;
  margin-top: 60px;
}

/* ---------- controles táctiles ---------- */
.touch-only {
  display: none;
}
html.is-touch .touch-only {
  display: flex;
}
html.is-touch p.touch-only {
  display: block;
}
#touch {
  position: fixed;
  left: 0;
  right: 0;
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 20;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 clamp(14px, 4vw, 32px);
  pointer-events: none;
}
.touch-group {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}
.tbtn {
  pointer-events: auto;
  touch-action: none;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  font:
    700 30px/1 'Outfit',
    sans-serif;
  color: var(--marfil);
  background: rgba(138, 31, 61, 0.82);
  border: 2px solid rgba(212, 175, 124, 0.7);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-tap-highlight-color: transparent;
}
.tbtn--act {
  background: rgba(42, 13, 23, 0.82);
  width: 68px;
  height: 68px;
}
.tbtn--jump {
  width: 88px;
  height: 88px;
  background: rgba(138, 31, 61, 0.9);
  font-size: 38px;
}
.tbtn.on {
  transform: scale(0.92);
  filter: brightness(1.3);
}
@media (orientation: landscape) and (max-height: 520px) {
  .tbtn {
    width: 62px;
    height: 62px;
  }
  .tbtn--act {
    width: 56px;
    height: 56px;
  }
  .tbtn--jump {
    width: 72px;
    height: 72px;
  }
  #touch {
    bottom: 10px;
  }
}
@media (prefers-reduced-motion: reduce) {
  #opening-header {
    animation: none;
  }
  * {
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 440px) {
  .touch-group {
    gap: 8px;
  }
  .tbtn {
    width: 62px;
    height: 62px;
    font-size: 26px;
  }
  .tbtn--act {
    width: 54px;
    height: 54px;
  }
  .tbtn--jump {
    width: 70px;
    height: 70px;
    font-size: 32px;
  }
}
@media (orientation: landscape) and (max-height: 520px) {
  .dtop {
    height: 38px;
  }
  .dtop nav a {
    min-height: 28px;
    font-size: 13px;
    padding: 0 11px;
  }
  .dtop__brand span {
    display: none;
  }
  .dtop__brand img {
    height: 24px;
    width: auto;
  }
}
#rotate-hint {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  z-index: 10;
  text-align: center;
  padding: 0 28px;
  color: rgba(250, 248, 247, 0.7);
  font-size: 15px;
  line-height: 1.5;
  pointer-events: none;
}
html.is-touch.is-portrait #rotate-hint {
  display: block;
}

/* ---------- mejoras: pantalla completa, mejor marca ---------- */
.dtop-btn {
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: #faf8f7;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(250, 248, 247, 0.28);
}
.dtop-btn:hover {
  background: rgba(250, 248, 247, 0.12);
}
.dtop-btn:focus-visible,
.button:focus-visible,
.menu-button:focus-visible {
  outline: 3px solid #d4af7c;
  outline-offset: 3px;
}
#opening-best {
  bottom: 262px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 26px;
  color: var(--oro);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
}
#win-best {
  font-size: 26px;
  color: var(--oro);
  margin: 4px 0 16px;
  text-align: center;
}
@media (max-width: 640px) {
  .dtop-btn {
    display: none;
  }
  html.is-touch .dtop-btn {
    display: inline-flex;
    padding: 0 10px;
    font-size: 13px;
  }
}
