@import url("/shared/styles/tokens.css");
@font-face {
  font-family: "Flowmery";
  src: url("/assets/fonts/Flowmery-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  display: grid;
  place-items: stretch;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--dash-theme, #0d9488) 82%, #ffffff) 0%,
    color-mix(in srgb, var(--dash-theme, #0d9488) 58%, #0f172a) 100%
  );
  color: #f8fafc;
  font-family: "Raleway", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

html,
body.wedding-dash-body {
  height: 100%;
}

body.wedding-dash-body {
  overflow: hidden;
}

.frame {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  aspect-ratio: auto;
  border-radius: 0;
  overflow: hidden;
  box-sizing: border-box;
  padding-bottom: 0;
  border: 0;
  box-shadow: none;
  background:
    linear-gradient(180deg, rgba(8, 12, 24, 0.46), rgba(8, 12, 24, 0.62)),
    url("/games/wedding-dash/assets/dash-portrait.png") center / cover no-repeat;
}

#game {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  background:
    linear-gradient(180deg, rgba(8, 12, 24, 0.5), rgba(8, 12, 24, 0.74)),
    url("/games/wedding-dash/assets/dash-portrait.png") center / cover no-repeat;
}

.dash-title-banner {
  display: none !important;
}

.dash-logo {
  position: absolute;
  top: max(16px, calc(env(safe-area-inset-top) + 10px));
  left: 50%;
  z-index: var(--z-raised);
  width: clamp(160px, 46vw, 300px);
  height: auto;
  transform: translateX(-50%);
  pointer-events: none;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.44));
}

.launch-screen {
  position: absolute;
  inset: 0;
  z-index: var(--z-raised);
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  background:
    var(--game-accent, #8e9380)
    url("/games/wedding-dash/assets/dash-portrait.png") center / cover no-repeat;
}

.launch-screen__couple {
  position: absolute;
  top: 63%;
  left: 50%;
  transform: translate(-50%, -50%) scale(var(--launch-couple-scale, 1));
  transform-origin: center center;
  width: max-content;
  max-width: calc(100vw - 44px);
  white-space: nowrap;
  font-family: "Flowmery", "Times New Roman", serif;
  font-size: clamp(26px, 11.6vw, 44px);
  letter-spacing: 0.02em;
  line-height: 1;
  padding: 0;
  text-align: center;
  color: #ffffff;
  -webkit-text-stroke: 4px rgba(0, 0, 0, 0.98);
  paint-order: stroke fill;
  pointer-events: none;
  z-index: var(--z-raised);
}

.launch-screen__hint {
  position: absolute;
  left: 50%;
  bottom: max(26px, calc(10% + env(safe-area-inset-bottom)));
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: rgba(15, 23, 42, 0.26);
  color: rgba(255, 255, 255, 0.94);
  font-size: clamp(0.85rem, 3.8vw, 0.98rem);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  animation: launch-hint-pulse 1.9s ease-in-out infinite;
  pointer-events: none;
}

.launch-screen[hidden] {
  display: none;
}

.overlay,
.gameover,
.countdown,
.character-select {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 20px;
  z-index: var(--z-raised);
}

.overlay {
  background:
    linear-gradient(180deg, rgba(8, 12, 24, 0.54), rgba(8, 12, 24, 0.72)),
    url("/games/wedding-dash/assets/dash-portrait.png") center / cover no-repeat;
  gap: 12px;
}

.overlay__title {
  margin: 0;
  font-family: "Cormorant Garamond", "Times New Roman", serif;
  font-size: clamp(2rem, 7vw, 2.5rem);
  color: #fff8ee;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
}

.overlay__home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.36);
  background: rgba(15, 23, 42, 0.58);
  color: #ffffff;
  text-decoration: none;
  font-weight: 700;
}

.overlay__home:hover,
.overlay__home:focus-visible {
  background: rgba(15, 23, 42, 0.76);
}

.countdown {
  background:
    linear-gradient(180deg, rgba(2, 6, 23, 0.42), rgba(2, 6, 23, 0.56)),
    url("/games/wedding-dash/assets/dash-portrait.png") center / cover no-repeat;
}

.countdown__card {
  width: min(340px, calc(100vw - 40px));
  border-radius: var(--radius-lg);
  border: 1px solid color-mix(in srgb, var(--game-accent, var(--dash-theme, #0d9488)) 74%, #0f172a 26%);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--game-accent-secondary, var(--dash-theme, #0d9488)) 88%, #ffffff 12%),
    var(--game-accent, var(--dash-theme, #0d9488))
  );
  color: var(--dash-countdown-ink, var(--game-cta-contrast, #ffffff));
  box-shadow: 0 16px 34px rgba(2, 6, 23, 0.42);
  padding: 18px 18px 16px;
  transform: translateY(8vh);
  animation: dash-countdown-drop 240ms ease-out forwards;
}

.countdown__text {
  font-size: clamp(2.4rem, 14vw, 4.1rem);
  font-weight: 900;
  letter-spacing: 0.06em;
  color: inherit;
  line-height: 1;
}

.countdown__hint {
  margin: 6px 0 0;
  max-width: 26ch;
  color: color-mix(in srgb, currentColor 88%, transparent);
}

@keyframes dash-countdown-drop {
  from {
    transform: translateY(4vh);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes launch-hint-pulse {
  0%,
  100% {
    opacity: 0.82;
    transform: translateX(-50%) translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateX(-50%) translateY(-1px);
  }
}

.character-select {
  background:
    linear-gradient(180deg, rgba(2, 6, 23, 0.46), rgba(2, 6, 23, 0.72)),
    url("/games/wedding-dash/assets/dash-portrait.png") center / cover no-repeat;
}

.character-select__card {
  width: min(320px, 100%);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(10, 14, 28, 0.8);
  backdrop-filter: blur(3px);
  padding: 16px;
}

.character-select__title {
  margin: 0 0 12px;
  font-weight: 700;
  font-size: 1.05rem;
}

.character-select__options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.character-select__option {
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  color: #f8fafc;
  padding: 10px;
  display: grid;
  gap: 8px;
  justify-items: center;
  cursor: pointer;
}

.character-select__option img {
  width: 76px;
  height: 76px;
  object-fit: contain;
}

.character-select__option:hover,
.character-select__option:focus-visible {
  border-color: rgba(20, 184, 166, 0.7);
  background: rgba(20, 184, 166, 0.14);
}

.hud {
  position: absolute;
  top: max(4px, calc(env(safe-area-inset-top) + 2px));
  left: 10px;
  right: 10px;
  z-index: var(--z-raised);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}

html.is-demo-mode body.wedding-dash-body .hud__score {
  transform: none;
}

.hud__label,
.hud__score {
  border-radius: var(--radius-pill);
  padding: 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  background: rgba(2, 6, 23, 0.52);
  color: #f8fafc;
  font-weight: 700;
  font-size: 0.9rem;
  backdrop-filter: blur(3px);
}

.hud__score {
  font-family: "Press Start 2P", "VT323", monospace;
  letter-spacing: 0.06em;
  font-size: 0.74rem;
}

.gameover {
  background: rgba(2, 6, 23, 0.7);
}

.gameover__card {
  width: min(324px, 100%);
  background: rgba(10, 14, 28, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-lg);
  padding: 18px;
}

.gameover__title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
}

.gameover__player,
.gameover__score {
  margin: 8px 0 0;
}

.gameover__actions {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.gameover__btn {
  min-height: 42px;
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--game-accent, #0d9488) 72%, #000000 28%);
  background: var(--game-accent, #0d9488);
  color: var(--game-cta-contrast, #fff);
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
}

.gameover__btn--ghost {
  background: rgba(15, 23, 42, 0.6);
  border-color: rgba(255, 255, 255, 0.32);
}

.gameover__btn:hover,
.gameover__btn:focus-visible {
  filter: brightness(1.06);
}

.player-sprite {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  overflow: visible;
  pointer-events: none;
  z-index: var(--z-raised);
}

body.wedding-dash-body[data-dash-state="play"] .launch-screen__couple,
body.wedding-dash-body[data-dash-state="countdown"] .launch-screen__couple,
body.wedding-dash-body[data-dash-state="gameover"] .launch-screen__couple {
  display: none;
}

body.wedding-dash-body[data-dash-state="select"] .launch-screen__couple {
  top: 63%;
}

.player-sprite__layer {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: contain;
  object-position: center bottom;
  image-rendering: pixelated;
  transform-origin: top left;
  border: 0;
  background: transparent;
  box-shadow: none;
  animation: dash-run-bob 0.58s ease-in-out infinite alternate;
  animation-play-state: paused;
}

body.wedding-dash-body[data-dash-state="play"] .player-sprite__layer {
  animation-play-state: running;
}

@keyframes dash-run-bob {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-3px);
  }
}

@media (max-width: 480px) {
  .frame {
    width: 100vw;
    border-radius: 0;
    border: 0;
    min-height: 100dvh;
    aspect-ratio: auto;
  }
}
