/* ==========================================================================
   AQUA CASINO — PICK A KOKOLISHI
   Brand tokens: colors + type live at the top so they're easy to hand off.
   ========================================================================== */

:root{
  /* ---- Official Aqua Casino brand colors ---- */
  --aqua:        #34BCBD;
  --blue:        #0480B2;
  --navy:        #001244;
  --beige:       #F4EFE9;
  --yellow:      #F8CE29;
  --gold:        #C9A24B;   /* metallic-gold accent tone, sampled from the supplied artwork */
  --gold-light:  #F0D9A0;

  /* ---- Type ---- */
  --font-head: 'Aboreto', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* ---- Safe-area aware spacing ---- */
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);

  color-scheme: dark;
}

*{ box-sizing: border-box; }

/* Guarantee the native `hidden` attribute always wins, even against
   author rules of equal specificity (e.g. `.status-tag{ display: ... }`). */
[hidden]{ display: none !important; }

html, body{
  height: 100%;
  margin: 0;
  overscroll-behavior: none;
}

body{
  font-family: var(--font-body);
  background: var(--navy);
  -webkit-tap-highlight-color: transparent;
}

/* Brief veil while we check the server for an existing play, so a
   returning player never sees a flash of the welcome screen. */
.stage{ transition: opacity .25s ease; }
body.is-checking .stage{ opacity: 0; }

button{
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

/* ==========================================================================
   STAGE — full-viewport frame holding the supplied Aqua gradient
   ========================================================================== */

.stage{
  position: relative;
  width: 100%;
  min-height: 100svh;
  min-height: 100vh;
  background-color: var(--navy);
  background-size: cover;
  background-position: center;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

/* ==========================================================================
   SCREENS
   ========================================================================== */

.screen{
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(28px + var(--safe-t))
    24px
    calc(32px + var(--safe-b));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .5s ease;
}

.screen.is-active{
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.screen-inner{
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Screen 2 keeps the header compact and pins the kokolishinan lower,
   closer to where thumbs naturally rest, without leaving a dead gap. */
#screen-game .screen-inner{
  height: 100%;
  justify-content: center;
}

/* ==========================================================================
   LOGO
   ========================================================================== */

.logo{
  width: min(58vw, 250px);
  height: auto;
  margin-bottom: clamp(28px, 6vh, 48px);
  user-select: none;
  -webkit-user-drag: none;
}

.logo--small{
  width: min(34vw, 140px);
  margin-bottom: clamp(18px, 3.5vh, 28px);
  opacity: 0.92;
}

/* ==========================================================================
   TYPOGRAPHY
   ========================================================================== */

.copy-block{
  margin-bottom: clamp(32px, 7vh, 56px);
}

.copy-block--tight{
  margin-bottom: clamp(20px, 4vh, 32px);
}

.headline{
  font-family: var(--font-head);
  font-weight: 400;
  color: var(--beige);
  font-size: clamp(30px, 8.2vw, 42px);
  line-height: 1.22;
  letter-spacing: 0.01em;
  margin: 0 0 16px;
  text-shadow: 0 2px 18px rgba(0, 10, 40, 0.35);
}

.headline--md{
  font-size: clamp(24px, 6.4vw, 32px);
  margin-bottom: 10px;
}

.subtext{
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--beige);
  opacity: 0.86;
  font-size: clamp(15px, 4vw, 17px);
  line-height: 1.5;
  margin: 0 auto;
  max-width: 34ch;
}

/* ==========================================================================
   PRIMARY BUTTON — HUNGA
   ========================================================================== */

.btn-primary{
  position: relative;
  border: none;
  cursor: pointer;
  padding: 18px 64px;
  border-radius: 999px;
  font-family: var(--font-head);
  font-size: clamp(17px, 4.6vw, 20px);
  letter-spacing: 0.08em;
  color: var(--navy);
  background: linear-gradient(180deg, var(--gold-light) 0%, var(--gold) 55%, #B0863A 100%);
  box-shadow:
    0 10px 24px rgba(0, 8, 30, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transition: transform .15s ease, box-shadow .15s ease;
  min-height: 56px;
  min-width: 200px;
}

.btn-primary:active{
  transform: scale(0.96);
  box-shadow:
    0 4px 12px rgba(0, 8, 30, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

/* ==========================================================================
   SCREEN 2 — SHELL SELECTION
   ========================================================================== */

.shell-row{
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(4px, 3vw, 16px);
  width: 100%;
  margin-top: clamp(32px, 9vh, 64px);
}

.shell-slot{
  position: relative;
  flex: 1 1 0;
  max-width: 270px;
  aspect-ratio: 1 / 1.02;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: bob 4.5s ease-in-out infinite;
  transition: opacity .5s ease, transform .5s ease;
}

.shell-slot:nth-of-type(1){ animation-delay: -0.3s; }
.shell-slot:nth-of-type(2){ animation-delay: -1.6s; }
.shell-slot:nth-of-type(3){ animation-delay: -3.0s; }

@keyframes bob{
  0%, 100%{ transform: translateY(0); }
  50%{ transform: translateY(-3.5%); }
}

.shell-img{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 10px 18px rgba(0, 8, 30, 0.4));
}

.shell-img--closed{
  opacity: 1;
  transition: opacity .5s ease;
}

.shell-img--open{
  opacity: 0;
  transform: scale(0.94);
  transition: opacity .6s ease, transform .6s ease;
}

.shell-glow{
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(248, 216, 140, 0.9) 0%, rgba(248, 216, 140, 0) 68%);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity .5s ease, transform .5s ease;
  pointer-events: none;
}

/* --- state: another shell was not picked --- */
.shell-slot.is-receded{
  opacity: 0.32;
  transform: scale(0.88) translateY(0) !important;
  animation-play-state: paused;
  pointer-events: none;
}

/* --- state: this shell is disabled after pick locks --- */
.shell-row.is-locked .shell-slot{
  pointer-events: none;
}

/* --- state: this shell is the chosen one --- */
.shell-slot.is-selected{
  animation-play-state: paused;
  transform: scale(1.14);
  z-index: 2;
}

.shell-slot.is-selected.is-anticipating{
  animation: anticipate .5s ease-in-out;
}

@keyframes anticipate{
  0%{ transform: scale(1.14) rotate(0deg); }
  30%{ transform: scale(1.18) rotate(-2.5deg); }
  60%{ transform: scale(1.16) rotate(2deg); }
  100%{ transform: scale(1.14) rotate(0deg); }
}

.shell-slot.is-opening .shell-img--closed{
  opacity: 0;
}

.shell-slot.is-opening .shell-img--open{
  opacity: 1;
  transform: scale(1);
}

.shell-slot.is-opening .shell-glow{
  opacity: 1;
  transform: scale(1);
}

/* --- a few restrained sparkles, only on the opening shell --- */
.sparkle-field{
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity .4s ease;
}

.shell-slot.is-sparkling .sparkle-field{ opacity: 1; }

.sparkle-field::before,
.sparkle-field::after{
  content: '';
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 8px 2px rgba(248, 206, 41, 0.9);
  animation: sparkle-pop 1s ease-out infinite;
}

.sparkle-field::before{ top: 18%; left: 22%; animation-delay: 0s; }
.sparkle-field::after{ top: 30%; right: 18%; animation-delay: .35s; }

@keyframes sparkle-pop{
  0%{ opacity: 0; transform: scale(0.3); }
  40%{ opacity: 1; transform: scale(1); }
  100%{ opacity: 0; transform: scale(0.3); }
}

/* ==========================================================================
   SCREEN 3 — PRIZE REVEAL
   ========================================================================== */

.win-shell{
  position: relative;
  width: min(58vw, 250px);
  aspect-ratio: 1 / 0.95;
  margin-bottom: clamp(8px, 2vh, 16px);
}

.win-shell-img{
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 12px 22px rgba(0, 8, 30, 0.45));
}

.shell-glow--win{
  inset: 4%;
  opacity: 1;
  transform: scale(1);
  animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow{
  0%, 100%{ opacity: 0.75; }
  50%{ opacity: 1; }
}

.headline--win{
  margin-top: clamp(4px, 1.5vh, 10px);
  margin-bottom: 4px;
  font-size: clamp(32px, 9vw, 46px);
}

.win-subtext{
  font-family: var(--font-head);
  color: var(--gold-light);
  font-size: clamp(16px, 4.4vw, 19px);
  letter-spacing: 0.14em;
  margin: 0 0 clamp(14px, 3vh, 22px);
}

.prize-amount{
  margin: 0 0 clamp(20px, 4.5vh, 32px);
}

#prize-value{
  font-family: var(--font-head);
  color: var(--yellow);
  font-size: clamp(44px, 13vw, 64px);
  line-height: 1;
  text-shadow: 0 2px 20px rgba(248, 206, 41, 0.35);
}

.redeem-text{
  font-family: var(--font-body);
  color: var(--beige);
  opacity: 0.9;
  font-size: clamp(15px, 4vw, 17px);
  max-width: 30ch;
  margin: 0 0 clamp(14px, 3vh, 20px);
}

/* ---- small pill labels: DEMO watermark + "already played" notice ---- */
.status-tag{
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--navy);
  background: var(--beige);
  padding: 6px 16px;
  border-radius: 999px;
}

.status-tag--demo{
  opacity: 0.75;
  margin-top: clamp(10px, 2vh, 18px);
}

.status-tag--returning{
  background: var(--gold-light);
  margin-bottom: clamp(14px, 3vh, 22px);
}

/* ---- redemption code + QR shown to the hostess ---- */
.play-code-block{
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 0 clamp(10px, 2vh, 16px);
}

.qr-code{
  background: var(--beige);
  padding: 8px;
  border-radius: 12px;
  line-height: 0;
  margin-bottom: 10px;
}

.qr-code img,
.qr-code svg{
  display: block;
  width: 120px;
  height: 120px;
}

.play-code-text{
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: 0.06em;
  font-size: 14px;
  color: var(--beige);
  opacity: 0.85;
  margin: 0;
}

.network-notice{
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--beige);
  background: rgba(216, 84, 63, 0.25);
  border: 1px solid rgba(216, 84, 63, 0.5);
  padding: 10px 16px;
  border-radius: 10px;
  max-width: 30ch;
  margin: 0 0 clamp(10px, 2vh, 16px);
}

/* ==========================================================================
   REDUCED MOTION
   ========================================================================== */

@media (prefers-reduced-motion: reduce){
  .shell-slot{ animation: none !important; }
  .shell-slot.is-anticipating{ animation: none !important; }
  .shell-glow--win{ animation: none !important; opacity: 1; }
  .sparkle-field::before,
  .sparkle-field::after{ animation: none !important; opacity: 0; }
  .screen{ transition: opacity .01s linear; }
}

/* ==========================================================================
   SMALL-HEIGHT PHONES — tighten vertical rhythm so nothing scrolls
   ========================================================================== */

@media (max-height: 700px){
  .logo{ width: min(46vw, 190px); margin-bottom: 20px; }
  .copy-block{ margin-bottom: 22px; }
  .headline{ font-size: clamp(24px, 7vw, 34px); }
}
