.App {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background-color: #fbf7ef;
  position: relative;
  background-image: url("./assets/background-image.svg");
  background-size: cover;
  overflow: auto;
  padding: 14px;
}

.playArea {
  --selector-width: clamp(340px, 30vw, 430px);
  --stage-gap: clamp(10px, 1.8vw, 22px);
  width: calc(100vw - 28px);
  max-width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  justify-content: center;
  justify-items: center;
  gap: var(--stage-gap);
}

.playAreaWithSelector {
  grid-template-columns: var(--selector-width) minmax(0, 1fr);
}

.playAreaWithSelector .gameContainer {
  max-width: 100%;
  justify-self: center;
}

.gameContainer {
  width: 80vw;
  height: 60vh;
  overflow: hidden;
  border: 3px solid rgba(19, 60, 70, 0.86);
  border-radius: 14px;
  position: relative;
  box-shadow: 0 22px 52px rgba(19, 60, 70, 0.24);
  min-width: 0;
  max-width: 100%;
}

.gameContainer :global(#skiing-game-container) {
  width: 100%;
  height: 100%;
}

.gameContainer canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.missionHud {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  z-index: 8;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.missionCluster {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.progressPill,
.commandPill,
.targetPill {
  min-height: 54px;
  display: flex;
  align-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  border: 2px solid rgba(19, 60, 70, 0.16);
  box-shadow: 0 8px 24px rgba(19, 60, 70, 0.14);
  backdrop-filter: blur(6px);
}

.progressPill {
  gap: 7px;
  padding: 6px 12px 6px 8px;
}

.commandGroup {
  display: flex;
  align-items: center;
  gap: 8px;
}

.commandPill {
  gap: 8px;
  padding: 5px 10px;
}

.targetPill {
  justify-content: center;
  padding: 4px 10px;
}

.hudActions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.infoButton {
  width: 54px;
  height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(19, 60, 70, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: #133c46;
  box-shadow: 0 8px 24px rgba(19, 60, 70, 0.14);
  backdrop-filter: blur(6px);
  cursor: pointer;
  pointer-events: auto;
}

.infoButton svg {
  width: 26px;
  height: 26px;
  stroke-width: 2.7;
}

.infoButton:hover {
  background: #ffffff;
  transform: translateY(-1px);
}

.infoButton:focus-visible,
.infoCloseButton:focus-visible,
.fallbackTiltButton:focus-visible {
  outline: 3px solid rgba(72, 174, 203, 0.74);
  outline-offset: 3px;
}

.infoModalBackdrop {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 26px;
  background: rgba(19, 60, 70, 0.42);
  backdrop-filter: blur(3px);
  pointer-events: auto;
  animation: infoBackdropFade 160ms ease-out both;
}

.infoModalPanel {
  width: min(560px, 100%);
  border-radius: 10px;
  border: 2px solid rgba(19, 60, 70, 0.18);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 56px rgba(19, 60, 70, 0.28);
  padding: 20px;
  animation: infoPanelDrop 220ms ease-out both;
}

.infoModalHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.infoModalHeader h2 {
  margin: 0;
  font-family: "Lato Bold", sans-serif;
  font-size: 2rem;
  line-height: 1;
  color: #133c46;
}

.infoCloseButton {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: rgba(19, 60, 70, 0.1);
  color: #133c46;
  cursor: pointer;
}

.infoCloseButton svg {
  width: 23px;
  height: 23px;
}

.infoModalSteps {
  display: grid;
  gap: 12px;
}

.infoStep {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  min-height: 70px;
}

.infoStepIcon {
  width: 62px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(72, 174, 203, 0.14);
  border: 2px solid rgba(72, 174, 203, 0.28);
}

.infoStepIcon svg {
  width: 46px;
  height: 46px;
}

.infoStep p {
  margin: 0;
  font-family: "Lato Regular", sans-serif;
  font-size: 1.1rem;
  line-height: 1.32;
  color: #133c46;
}

@keyframes infoBackdropFade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes infoPanelDrop {
  from {
    opacity: 0;
    transform: translateY(-28px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.flagsIcon {
  width: 34px;
  height: 34px;
}

.flagsTargetIcon {
  width: clamp(118px, 15vw, 160px);
  height: 52px;
}

.score {
  letter-spacing: 2px;
  min-width: 70px;
  font-family: "Lato Bold", sans-serif;
  font-size: clamp(1.45rem, 3vw, 2.25rem);
  line-height: 1;
  text-align: center;
  color: #133c46;
  transition: transform 0.2s ease-in-out;
}

.score span {
  color: rgba(19, 60, 70, 0.56);
  font-size: 0.62em;
  letter-spacing: 0;
}

.zoom {
  transform: scale(1.18);
}

.flagFeedback {
  position: absolute;
  top: 42%;
  left: 50%;
  z-index: 9;
  pointer-events: none;
  transform: translate(-50%, -50%);
  font-family: "Lato Bold", sans-serif;
  font-size: clamp(3.5rem, 9vw, 7.5rem);
  line-height: 1;
  color: #ffffff;
  text-shadow:
    0 4px 0 #e0a51f,
    0 0 18px rgba(254, 230, 90, 0.9),
    0 12px 28px rgba(19, 60, 70, 0.22);
  animation: flagFeedbackBurst 900ms ease-out forwards;
}

@keyframes flagFeedbackBurst {
  0% {
    opacity: 0;
    transform: translate(-50%, -36%) scale(0.68);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.08);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -92%) scale(1.34);
  }
}

.commandTriggerIcon,
.commandActionIcon {
  width: 42px;
  height: 42px;
}

.commandArrow {
  color: #133c46;
  font-family: "Lato Bold", sans-serif;
  font-size: 1.3rem;
}

.fallbackTiltControls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.fallbackTiltButton {
  height: 54px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: #133c46;
  color: white;
  font-family: "Lato Bold", sans-serif;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(19, 60, 70, 0.18);
  pointer-events: auto;
}

.selectorPanel {
  width: var(--selector-width);
  min-height: min(360px, 70vh);
  z-index: 7;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  justify-content: center;
  gap: 10px;
}

@media (max-width: 1160px) {
  .playAreaWithSelector {
    --selector-width: clamp(300px, 34vw, 390px);
  }

  .missionCluster {
    align-items: flex-start;
  }

  .targetPill {
    display: none;
  }

  .progressPill,
  .commandPill {
    min-height: 46px;
  }

  .commandTriggerIcon,
  .commandActionIcon {
    width: 34px;
    height: 34px;
  }

  .fallbackTiltButton,
  .infoButton {
    height: 46px;
  }

  .infoButton {
    width: 46px;
  }

  .commandGroup {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}

@media (max-width: 900px) {
  .playAreaWithSelector {
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
  }

  .playAreaWithSelector .gameContainer {
    max-width: calc(100vw - 28px);
  }

  .selectorPanel {
    width: min(420px, 100%);
    min-height: 300px;
    order: 2;
    transform: scale(0.86);
    transform-origin: top center;
  }
}

@media (max-width: 760px) {
  .missionHud {
    top: 6px;
    left: 6px;
    right: 6px;
    align-items: stretch;
    gap: 4px;
  }

  .missionCluster {
    gap: 4px;
    flex-wrap: wrap;
  }

  .targetPill {
    display: none;
  }

  .hudActions {
    gap: 4px;
  }

  .infoButton {
    width: 38px;
    height: 38px;
  }

  .infoButton svg {
    width: 21px;
    height: 21px;
  }

  .progressPill,
  .commandPill {
    min-height: 38px;
  }

  .commandPill {
    padding: 3px 6px;
  }

  .commandTriggerIcon,
  .commandActionIcon {
    width: 28px;
    height: 28px;
  }

  .commandArrow {
    font-size: 1rem;
  }

  .fallbackTiltButton {
    height: 38px;
    padding: 0 10px;
    font-size: 0.86rem;
  }

  .selectorPanel {
    min-height: 260px;
  }

  .infoModalBackdrop {
    padding: 14px;
  }

  .infoModalPanel {
    padding: 16px;
  }

  .infoModalHeader h2 {
    font-size: 1.55rem;
  }

  .infoStep {
    grid-template-columns: 50px minmax(0, 1fr);
    gap: 10px;
    min-height: 58px;
  }

  .infoStepIcon {
    width: 50px;
    height: 50px;
  }

  .infoStepIcon svg {
    width: 36px;
    height: 36px;
  }

  .infoStep p {
    font-size: 0.98rem;
  }
}

@media (max-width: 520px) {
  .flagsIcon {
    width: 24px;
    height: 24px;
  }

  .score {
    min-width: 48px;
    font-size: 1.1rem;
  }
}
