/* Chicken Jump — styles autonomes (invit + standalone) */

@font-face {
  font-family: "Jurassic Park";
  src: url("../../assets/fonts/Jurassic_Park.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

.chicken-jump-theme {
  --red: #b80d00;
  --black: #000000;
  --yellow: #ffc000;
  --green: #a2920e;
  --text-soft: #201d00;
  --font: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --font-display: "Jurassic Park", fantasy;
}

body.is-minigame {
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
}

.minigame-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  background: var(--green, #a2920e);
  color: var(--black, #000);
  touch-action: none;
  overscroll-behavior: none;
}

.minigame-overlay[hidden] {
  display: none;
}

.minigame-overlay__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: 0 0 auto;
  padding: calc(8px + env(safe-area-inset-top, 0)) 10px 8px;
  background: rgba(0, 0, 0, 0.2);
}

.minigame-overlay__title {
  margin: 0;
  flex: 0 1 auto;
  min-width: 0;
  font-family: var(--font-display, fantasy);
  font-size: clamp(1.6rem, 5vw, 1.9rem);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--yellow, #ffc000);
}

.minigame-overlay__stats {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.minigame-overlay__stats[hidden] {
  display: none;
}

.minigame-overlay__stat {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 5px 8px;
  border: 1px solid rgba(0, 0, 0, 0.55);
  border-radius: 2px;
  background: #111;
  line-height: 1;
}

.minigame-overlay__stat-label {
  font-family: var(--font, system-ui, sans-serif);
  font-size: clamp(1rem, 2.4vw, 1.05rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #aaa;
}

.minigame-overlay__stat-value {
  font-family: var(--font, system-ui, sans-serif);
  font-size: clamp(1rem, 3.4vw, 1.15rem);
  font-weight: 700;
  color: #fff;
  min-width: 1.2em;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.minigame-overlay__stat:first-child .minigame-overlay__stat-value {
  color: var(--yellow, #ffc000);
}

.minigame-overlay__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: clamp(28px, 8vw, 36px);
  height: clamp(28px, 8vw, 36px);
  flex: 0 0 auto;
  margin: 0;
  padding: 5px;
  border: none;
  border-radius: 50%;
  background: #000;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.minigame-overlay__close img {
  display: block;
  width: clamp(14px, 4.5vw, 20px);
  height: clamp(14px, 4.5vw, 20px);
  pointer-events: none;
}

.minigame-overlay__close:focus-visible {
  outline: 2px solid var(--yellow, #ffc000);
  outline-offset: 2px;
}

.minigame-overlay__stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.mg {
  position: relative;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.mg__hud {
  position: absolute;
  top: 8px;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  pointer-events: none;
}

.mg__hint {
  margin: 0;
  font-family: var(--font, system-ui, sans-serif);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-soft, #201d00);
}

.mg__hint:empty {
  display: none;
}

.mg__play {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.mg.chicken-jump {
  background: #000000;
}

.mg.chicken-jump .mg__play {
  left: 50%;
  right: auto;
  width: min(100%, 360px);
  transform: translateX(-50%);
  background: linear-gradient(180deg, #7eb8e8 0%, #a2920e 55%, #6b5f0a 100%);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35);
}

.mg__overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.45);
  text-align: center;
}

.mg__overlay[hidden] {
  display: none;
}

.chicken-jump__ready {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
  background: transparent;
}

.chicken-jump__ready[hidden] {
  display: none;
}

.chicken-jump__go-flash {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: transparent;
}

.chicken-jump__go-flash[hidden] {
  display: none;
}

.chicken-jump__go {
  margin: 0;
  font-family: var(--font-display, fantasy);
  font-size: clamp(3rem, 16vw, 4.8rem);
  font-weight: 400;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
  color: var(--yellow, #ffc000);
  text-shadow: 0 2px 0 #000, 0 0 18px rgba(0, 0, 0, 0.45);
  transform: scale(0.7);
  opacity: 0;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.chicken-jump__go-flash.is-in .chicken-jump__go {
  transform: scale(1);
  opacity: 1;
}

.chicken-jump__go-hint {
  margin: 0;
  font-family: var(--font, system-ui, sans-serif);
  font-size: clamp(1rem, 3.6vw, 1.15rem);
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

@media (prefers-reduced-motion: reduce) {
  .chicken-jump__go {
    transition: none;
    transform: scale(1);
    opacity: 1;
  }
}

.mg__msg {
  margin: 0;
  font-family: var(--font-display, fantasy);
  font-size: clamp(1.8rem, 8vw, 2.6rem);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--yellow, #ffc000);
}

.mg__sub {
  margin: 0;
  font-family: var(--font, system-ui, sans-serif);
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
}

.mg__retry {
  margin-top: 6px;
  padding: 8px 14px;
  border: 2px solid var(--yellow, #ffc000);
  border-radius: 2px;
  background: var(--black, #000);
  color: var(--yellow, #ffc000);
  font-family: var(--font, system-ui, sans-serif);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.chicken-jump__world {
  position: absolute;
  inset: 0;
  overflow: visible;
  will-change: transform;
}

.chicken-jump__hen {
  position: absolute;
  width: 56px;
  height: 56px;
  z-index: 3;
  overflow: visible;
  transform-origin: center center;
  will-change: transform;
}

.chicken-jump__hen img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

.chicken-jump__bale {
  position: absolute;
  height: auto;
  z-index: 2;
  pointer-events: none;
  line-height: 0;
}

.chicken-jump__bale img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

.chicken-jump__cigale {
  position: absolute;
  z-index: 3;
  line-height: 0;
  pointer-events: none;
  transform-origin: center center;
  will-change: transform;
}

.chicken-jump__cigale img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

.chicken-jump__ground {
  position: absolute;
  z-index: 2;
  display: flex;
  flex-wrap: nowrap;
  overflow: hidden;
  pointer-events: none;
  line-height: 0;
}

.chicken-jump__ground img {
  display: block;
  flex: 0 0 auto;
  width: 100px;
  height: 40px;
  pointer-events: none;
}

/* Standalone page */
.cj-standalone {
  margin: 0;
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
  background: var(--green, #a2920e);
  color: var(--black, #000);
  font-family: var(--font, system-ui, sans-serif);
}

.cj-standalone .minigame-overlay {
  position: fixed;
  inset: 0;
  height: 100dvh;
  min-height: 100dvh;
}

.cj-standalone .minigame-overlay__stage,
.cj-standalone .mg {
  height: 100%;
  min-height: 0;
}
