/* Mobile-first enhancements for larger viewports. */

/* Keep the skip label («Сразу к акциям») visible on phones — tighten the padding, gap and
   type so the icon + label still fit the logo row down to a 320px-wide viewport
   (`smoke` asserts the HUD logo row never overflows). */
@media (max-width: 420px) {
  .hud__skip {
    padding: 0 9px;
    gap: 4px;
    font-size: 11px;
    letter-spacing: 0.02em;
  }
  .hud__skip svg {
    width: 14px;
    height: 14px;
  }
}

/* Very small phones */
@media (max-width: 360px) {
  .hud__gauge {
    min-width: 60px;
  }
  .hud__logo img {
    height: 20px;
  }
  .hud__skip {
    font-size: 10px;
  }
  .badge,
  .question-meta__sheet {
    font-size: 10px;
  }
}

/* Narrow screens: the bottom-right corner is taken by the AgroMozg mascot and the verdict
   copy is tight, so the decorative dossier folder is dropped there — it stays a desktop
   flourish (where it sits clear of the mascot, top-right of the verdict scene). */
@media (max-width: 899px) {
  .pos--dossier {
    display: none;
  }
}

/* ---- Desktop (>=900px) ---- */
@media (min-width: 900px) {
  .scene__content {
    max-width: min(760px, 60vw);
    margin-left: clamp(40px, 8vw, 150px);
    margin-right: auto;
  }
  .scene__scrim {
    background: linear-gradient(
      90deg,
      rgba(5, 8, 6, 0.94) 0%,
      rgba(5, 8, 6, 0.78) 44%,
      rgba(5, 8, 6, 0.22) 74%,
      rgba(5, 8, 6, 0) 100%
    );
  }
  .scene__art {
    opacity: 0.92;
  }
  .pos--agromozg-sm {
    right: 8%;
    width: clamp(200px, 24vw, 300px);
  }
  .pos--agromozg-intro {
    right: 5%;
    bottom: 7%;
    width: clamp(320px, 34vw, 470px);
    opacity: 0.92;
  }
  .pos--dossier {
    right: 2%;
    top: 10%;
  }

  /* Question content is centred horizontally (raster props sit behind it). */
  .scene[data-tone='dossier'] .scene__content {
    margin-left: auto;
    margin-right: auto;
    max-width: min(860px, 84vw);
  }
  .scene__content--question .step__lead {
    font-size: 16px;
  }
  .scene__content--question .answer {
    padding: 13px 16px;
  }

  /* Recipe reads as a sheet. */
  .scene__content--recipe {
    max-width: min(1100px, 82vw);
    margin-left: auto;
    margin-right: auto;
    padding-top: calc(var(--hud-h) + 28px + env(safe-area-inset-top, 0px));
  }
  .assignments {
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }
  .assignment {
    padding: 18px;
  }
  .assignment:nth-child(7),
  .assignment--bonus {
    grid-column: 1 / -1;
  }
  .recipe__avatar {
    width: 120px;
    height: 120px;
  }
}

/* ---- Moderate desktop scale-up ---- */
@media (min-width: 1200px) {
  .scene__content {
    max-width: min(1020px, 78vw);
  }
  .scene[data-tone='dossier'] .scene__content {
    max-width: min(920px, 78vw);
  }
  .scene__content--recipe {
    max-width: min(1160px, 86vw);
  }
  .step__title {
    font-size: clamp(32px, 3.8vw, 64px);
  }
  .step__body,
  .step__lead {
    font-size: clamp(16px, 1.05vw + 8px, 20px);
  }
  .step__paragraphs {
    gap: 14px;
  }
  .reveal__to {
    font-size: clamp(20px, 2.3vw, 34px);
  }
  .answer {
    font-size: clamp(15px, 0.8vw + 9px, 19px);
  }
  .question-bubble .step__title {
    font-size: clamp(24px, 1.7vw + 10px, 40px);
  }
  .scene__content--question .step__lead {
    font-size: clamp(16px, 1vw + 8px, 20px);
  }
  .scene__content--question .answer {
    padding: 15px 20px;
  }
  .assignment__title {
    font-size: clamp(17px, 1.1vw + 8px, 22px);
  }
  .assignment__text {
    font-size: clamp(14px, 0.5vw + 9px, 17px);
  }
  .pos--agromozg-intro {
    width: clamp(360px, 28vw, 560px);
  }
  /* A large decorative AgroMozg only where there is room beside the plan cards. */
  .pos--agromozg-recipe {
    display: block;
    right: 0;
    top: 12%;
    width: clamp(300px, 24vw, 460px);
    opacity: 0.4;
  }
}

/* Wider desktops */
@media (min-width: 1600px) {
  .scene__content {
    max-width: 1180px;
  }
  .scene[data-tone='dossier'] .scene__content {
    max-width: 1080px;
  }
  .step__title {
    font-size: clamp(44px, 3.4vw, 80px);
  }
}

/* ---- Screen 0 (video): phone card height ---- */
/* No still frame is shown, so the card only has to fit the panel. A 16:9 band is too
   short for the warning copy on a phone (the buttons would be clipped), so the card gets
   a minimum height instead; the video itself is only ever shown fullscreen, on Start. */
@media (max-width: 640px) {
  .video-stage {
    aspect-ratio: auto;
    min-height: clamp(300px, 56vh, 430px);
  }
  /* Compact buttons so НАЧАТЬ / ПРОПУСТИТЬ / ЗВУК fit one row. */
  .video-warning__actions .btn {
    min-height: 44px;
    padding: 10px 14px;
    font-size: 12.5px;
  }
}

/* ---- Plan: the closing congrats block stacks on phones ---- */
@media (max-width: 640px) {
  .recipe__outro {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    gap: 12px;
  }
  .recipe__outro-art {
    width: clamp(120px, 42vw, 190px);
  }
}

/* Very small phones: shrink the warning copy so the card still fits. */
@media (max-width: 380px) {
  .video-warning__body {
    font-size: 12.5px;
    line-height: 1.35;
  }
}

/* Short landscape phones: tighten vertical rhythm */
@media (max-height: 700px) and (orientation: landscape) {
  .scene__content {
    gap: 10px;
    padding-top: calc(var(--hud-h) + 12px);
  }
  .answers {
    gap: 8px;
  }
  .answer {
    padding: 12px 14px;
  }
}

/* ---- Question screens: stack the mascot above the bubble on phones ---- */
@media (max-width: 640px) {
  .question-stage {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }
  .question-mascot {
    align-self: center;
    width: clamp(84px, 24vw, 128px);
  }
  .question-bubble {
    --bubble-border: 2px;
    --tail-size: 16px;
    padding: 12px 14px;
  }
  .question-bubble .step__title {
    font-size: clamp(17px, 4.6vw, 24px);
    margin-bottom: 5px;
  }
  /* Tail flips to the top, pointing up at the mascot: same construction as the desktop tail
     (whole square, opaque matching fill, centre inside the border band), mirrored — the
     bordered top-left corner becomes the upward tip. */
  .question-bubble::after {
    left: 42px;
    right: auto;
    top: calc(-1 * (var(--tail-half) + var(--bubble-border) / 2));
    bottom: auto;
    border-left: var(--bubble-border) solid var(--question-bubble-edge);
    border-bottom: 0;
    border-top: var(--bubble-border) solid var(--question-bubble-edge);
    border-bottom-left-radius: 0;
  }
}

/* Prop density: fewer/looser motifs on smaller screens so nothing crowds the copy. */
@media (max-width: 899px) {
  .question-props {
    --props-density: 0.8;
  }
}
@media (max-width: 560px) {
  .question-props {
    --props-density: 0.62;
  }
  /* Anchored/single props are authored first, so hiding the tail only thins repeats. */
  .question-prop:nth-child(n + 6) {
    display: none;
  }
  .question-prop {
    opacity: 0.7;
  }
}

/* ---- Intro: pin the mascot flush to the right edge on phones so the centred CTA never
   overlaps it, and reserve a corridor to its left for the CTA row (the corridor matches
   the mascot width + a small gap, so the CTA's right edge always clears the mascot while
   the copy keeps its full width and still fits the frame). ---- */
@media (max-width: 640px) {
  .pos--agromozg-intro {
    right: 0;
    bottom: 0;
    width: clamp(120px, 34vw, 190px);
    opacity: 0.5;
  }
  .scene__content--intro .step__cta {
    padding-right: calc(clamp(120px, 34vw, 190px) + 14px);
  }
}
/* Very small phones keep the pinned geometry with a fixed width. */
@media (max-width: 360px) {
  .pos--agromozg-intro {
    right: 0;
    bottom: 0;
    width: 150px;
    opacity: 0.5;
  }
  .scene__content--intro .step__cta {
    padding-right: 164px;
  }
}
