:root {
  --orange: #ff7900;
  --orange-dark: #df6900;
  --ink: #151313;
  --warm: #f2e5d8;
  --warm-2: #e5d0bd;
  --paper: #ffffff;
  --app-vh: 100dvh;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: var(--warm);
  color: var(--ink);
}

body {
  overflow: hidden;
  font-family: Arial, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app-screen {
  width: 100%;
  height: var(--app-vh, 100dvh);
  min-height: 100svh;
  overflow: hidden;
}

.app-panel,
.prize-shell,
.landing-shell {
  width: 100%;
  max-width: 620px;
}

.orange-logo {
  display: block;
  height: auto;
  object-fit: contain;
}

.btn-orange {
  --bs-btn-color: #111;
  --bs-btn-bg: var(--orange);
  --bs-btn-border-color: var(--orange);
  --bs-btn-hover-color: #111;
  --bs-btn-hover-bg: #ff8a1a;
  --bs-btn-hover-border-color: #ff8a1a;
  --bs-btn-active-color: #111;
  --bs-btn-active-bg: var(--orange-dark);
  --bs-btn-active-border-color: var(--orange-dark);
  border-radius: 0;
  font-weight: 800;
  line-height: 1.05;
}

/* LANDING */
.landing-page,
.landing-screen {
  background: #000;
}

.landing-shell {
  position: relative;
  height: 100%;
  overflow: hidden;
  background: #000;
}

.landing-top {
  position: absolute;
  inset: 0 0 37.3% 0;
  overflow: hidden;
  background: #e8ded2 url("../img/fondo01.webp") top center / cover no-repeat;
}

.landing-title-top {
  position: absolute;
  z-index: 2;
  top: max(2.6%, env(safe-area-inset-top));
  left: max(4.6%, env(safe-area-inset-left));
  width: min(62.5%, 388px);
  height: auto;
  object-fit: contain;
}

.landing-bottom {
  position: absolute;
  z-index: 3;
  inset: auto 0 0;
  height: 37.5%;
  padding: clamp(12px, 1.9vh, 18px) max(6.5%, env(safe-area-inset-right))
    max(clamp(12px, 1.6vh, 18px), env(safe-area-inset-bottom))
    max(6.5%, env(safe-area-inset-left));
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  row-gap: clamp(7px, 1.15vh, 11px);
  background: #000;
}

.landing-title-bottom {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: none;
  min-height: 0;
  object-fit: contain;
  object-position: left center;
  align-self: stretch;
  justify-self: stretch;
}

.landing-actions {
  min-height: 0;
  margin-top: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: clamp(16px, 6vw, 46px);
}

.landing-action-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.landing-logo {
  width: clamp(56px, 15.1vw, 92px);
  max-height: clamp(72px, 18.8vw, 118px);
  flex: 0 0 auto;
  margin: 0 0 1px;
}

.landing-cta {
  width: min(100%, 190px);
  min-height: 0;
  padding: clamp(7px, 1.2vh, 11px) clamp(12px, 3.6vw, 18px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  line-height: 1;
}

.landing-cta img {
  display: block;
  width: 100%;
  max-width: 166px;
  height: auto;
}

.landing-limited {
  margin-top: clamp(7px, 1.05vh, 11px);
  line-height: 1;
}

.landing-limited img {
  display: block;
  width: min(100%, 150px);
  height: auto;
}

.landing-error {
  margin: auto 0;
  font-size: clamp(0.78rem, 3.4vw, 1rem);
}

@media (max-height: 760px) {
  .landing-bottom {
    height: 39%;
    padding-top: 12px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  .landing-top {
    bottom: 38.8%;
  }
  .landing-title-top {
    width: min(57%, 350px);
  }
  .landing-title-bottom {
    width: 100%;
    height: 100%;
    max-height: none;
  }
  .landing-logo {
    width: clamp(49px, 13.4vw, 78px);
  }
  .landing-cta {
    width: min(100%, 172px);
    padding-top: 6px;
    padding-bottom: 6px;
  }
  .landing-limited {
    margin-top: 5px;
  }
}

@media (max-height: 640px) {
  .landing-bottom {
    height: 40%;
    padding-top: 8px;
  }
  .landing-top {
    bottom: 39.8%;
  }
  .landing-title-top {
    width: min(52%, 320px);
  }
  .landing-title-bottom {
    width: 100%;
    height: 100%;
    max-height: none;
  }
  .landing-logo {
    width: clamp(44px, 12vw, 68px);
  }
  .landing-cta {
    width: min(100%, 154px);
    padding: 5px 10px;
  }
  .landing-limited img {
    width: min(100%, 130px);
  }
}

@media (min-aspect-ratio: 3 / 5) and (max-height: 760px) {
  .landing-title-top {
    top: max(1.7%, env(safe-area-inset-top));
    width: min(50%, 306px);
  }
}

/* GAME */
.game-page,
.game-screen {
  background: #000;
}

.game-page::before {
  content: none;
}

.prize-page {
  /* background:
    radial-gradient(
      circle at 15% 25%,
      rgba(255, 255, 255, 0.68),
      transparent 34%
    ),
    linear-gradient(125deg, #ead5c0 0%, #f7f2ed 52%, #dac0a9 100%); */
  background-color: #000;
}

.prize-page::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  /* opacity: 0.26; */
  /* background:
    linear-gradient(
      90deg,
      transparent 0 78%,
      rgba(255, 255, 255, 0.8) 78% 80%,
      transparent 80%
    ),
    linear-gradient(
      0deg,
      transparent 0 18%,
      rgba(104, 78, 57, 0.15) 18% 19%,
      transparent 19%
    ); */
}

.game-screen {
  padding: 0;
}

.game-screen .app-panel {
  background: #000;
}

.game-header {
  width: 100%;
  margin: 0;
  padding: 0;
  line-height: 0;
}

.game-header-art {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  padding: 0;
}

.scratch-stack {
  display: grid;
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: clamp(6px, 1.05vh, 11px);
  min-height: 0;
  padding: 0 max(18px, env(safe-area-inset-right)) 0
    max(18px, env(safe-area-inset-left));
}

.scratch-card {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.78);
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 7px 20px rgba(0, 0, 0, 0.34);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    border-color 0.2s ease;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.scratch-card.is-locked {
  opacity: 0.44;
  transform: scale(0.988);
  pointer-events: none;
}

.scratch-card.is-won {
  border-color: var(--orange);
  box-shadow:
    0 0 0 3px rgba(255, 121, 0, 0.16),
    0 7px 20px rgba(0, 0, 0, 0.34);
}

.scratch-reveal,
.scratch-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.scratch-reveal {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 4vw, 24px);
  background: #fff;
  color: var(--orange);
}

.scratch-cap {
  width: min(26%, 106px);
  height: auto;
  max-height: 70%;
}

.scratch-win-text {
  color: #171717;
  font-size: clamp(0.92rem, 4.5vw, 1.45rem);
  font-weight: 800;
  letter-spacing: 0.035em;
}

.scratch-canvas {
  display: block;
  cursor: crosshair;
  touch-action: none;
}

.game-bottom-space {
  height: max(clamp(8px, 1.5vh, 15px), env(safe-area-inset-bottom));
}

.game-loading {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.94);
  color: #111;
  font-size: 1.05rem;
  font-weight: 800;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.18s ease,
    visibility 0.18s ease;
}

.game-loading.is-visible {
  opacity: 1;
  visibility: visible;
}

.unlock-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--orange);
  color: #111;
  font-size: 2rem;
  font-weight: 900;
}

/* PRIZE */
.prize-screen {
  padding-left: max(18px, env(safe-area-inset-left));
  padding-right: max(18px, env(safe-area-inset-right));
  padding-top: max(14px, env(safe-area-inset-top));
  padding-bottom: max(14px, env(safe-area-inset-bottom));
}

.prize-shell {
  position: relative;
}

.prize-brand {
  /* Reserve the logo area in the normal flex flow so the prize card can never cover it. */
  height: auto;
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  padding-bottom: clamp(12px, 2vh, 20px);
}

.prize-logo {
  width: clamp(58px, 14.5vw, 82px);
}

.prize-card {
  min-height: 0;
  padding: clamp(16px, 3vh, 28px) clamp(16px, 4.5vw, 30px);
  border: clamp(5px, 1.25vw, 8px) solid var(--orange);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 34px rgba(73, 48, 29, 0.14);
}

.prize-image-wrap {
  width: 100%;
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.prize-image {
  display: block;
  max-width: min(92%, 430px);
  max-height: min(34vh, 300px);
  object-fit: contain;
}

.prize-card h1 {
  margin: clamp(8px, 1.4vh, 14px) 0 0;
  font-size: clamp(1.45rem, 6.4vw, 2.25rem);
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: -0.035em;
}

.prize-card p {
  margin: clamp(9px, 1.4vh, 14px) 0 clamp(14px, 2.2vh, 22px);
  color: var(--orange);
  font-size: clamp(1.02rem, 4.4vw, 1.38rem);
  font-weight: 700;
  line-height: 1.02;
}

.prize-card p strong {
  font-weight: 800;
}

.prize-cta {
  flex: 0 0 auto;
  padding: 0.78rem 1rem 0.72rem;
  font-size: clamp(1rem, 4.3vw, 1.25rem);
}

@media (max-height: 680px) {
  .landing-bottom {
    height: 40%;
    padding-top: 15px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
  .landing-message h2 {
    margin-bottom: 12px;
    font-size: clamp(1.35rem, 6.2vw, 2rem);
  }
  .landing-limited {
    margin-top: 0.35rem;
  }
  .scratch-stack {
    gap: 5px;
  }
  .game-bottom-space {
    height: max(7px, env(safe-area-inset-bottom));
  }
  .prize-brand {
    height: auto;
    padding-bottom: 9px;
  }
  .prize-logo {
    width: 50px;
  }
  .prize-card {
    padding-top: 11px;
    padding-bottom: 11px;
  }
  .prize-image {
    max-height: 29vh;
  }
  .prize-card h1 {
    font-size: clamp(1.25rem, 5.6vw, 1.7rem);
  }
  .prize-card p {
    margin-top: 7px;
    margin-bottom: 10px;
    font-size: clamp(0.92rem, 4vw, 1.1rem);
  }
}

@media (max-height: 600px) {
  .prize-brand {
    padding-bottom: 7px;
  }
}

@media (orientation: landscape) and (max-height: 600px) {
  .game-header-art {
    height: min(36vh, 165px);
    object-fit: contain;
    object-position: center top;
  }
}

@media (max-height: 600px) {
  .scratch-stack {
    gap: 4px;
  }
  .game-bottom-space {
    height: max(5px, env(safe-area-inset-bottom));
  }
  .scratch-card {
    border-width: 2px;
    border-radius: 7px;
  }
}

@media (min-width: 768px) {
  .landing-shell,
  .app-panel,
  .prize-shell {
    max-width: 620px;
  }
  .landing-shell {
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.22);
  }
}
