/* Phones are the primary review surface. Desktop styling remains in experience.css. */
/* The isolated review blocks Netlify's external feedback frame. Hide its injected
   wrapper so the blocked 48px drawer cannot cover the catcher or phone actions. */
body > [data-netlify-deploy-id]:has(> iframe[title="Netlify Drawer"]) { display: none !important; }
@media (max-width: 700px) {
  html { scroll-padding-top: 16px; }
  body { font-size: 16px; line-height: 1.55; }
  .review-ribbon { min-height: 44px; padding: env(safe-area-inset-top, 0px) 16px 0; font-size: 11px; }
  .review-ribbon button { min-height: 44px; font-size: 11px; }
  .site-header { padding: 16px; gap: 12px; flex-wrap: wrap; }
  .site-header .wordmark { font-size: 28px; min-height: 44px; }
  .site-header nav { flex: 1 1 100%; gap: 8px; justify-content: space-between; }
  .nav-link, .nav-profile { font-size: 14px; min-height: 46px; padding: 10px 12px; }
  .nav-profile { max-width: 150px; min-width: 0; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .nav-profile span { display: none; }
  .section { padding: 36px 20px; }
  .eyebrow, .hero .eyebrow, .dashboard-hero .eyebrow { font-size: 11px; letter-spacing: 1.5px; }
  .btn, .btn.small, .wine-copy .btn { min-height: 50px; font-size: 15px; padding: 13px 18px; gap: 12px; }
  .text-btn, .back-link, .learning-link { min-height: 46px; font-size: 14px; }
  .filter-btn, .round-recap .recap-filter-row .filter-btn { min-height: 46px; font-size: 14px; }
  .field, input:not([type="checkbox"]), select { font-size: 16px; min-height: 50px; }
  .field { scroll-margin: 20px; }
  .tiny, .modal-inner .tiny, .review-note { font-size: 12px; line-height: 1.6; }
  .hero { margin: 0 12px; }
  .hero-copy { padding: 26px 24px; }
  .hero h1 { font-size: clamp(35px, 10.5vw, 44px); line-height: 1.07; }
  .hero-copy > p { font-size: 16px; line-height: 1.55; }
  .hero-copy .btn { width: 100%; margin-top: 20px; }
  .hero-copy .tiny { font-size: 12px; }
  .hero-art { height: 215px; }
  .hero-tag { font-size: 10px; letter-spacing: .6px; }
  .pair-card { gap: 8px; padding: 12px; }
  .pair-card strong { font-size: 12px; }
  .pair-card p { font-size: 11px; }
  .pair-card img { width: 34px; height: 39px; }
  .promise strong { font-size: 16px; }
  .promise p, .main-play p, .split-heading p, .journey-card p, .recap-card p,
  .reward-tile p, .bottom-panel p, .page-header > p, .panel p, .stage p,
  .wine-copy p, .rule-card p, .mode-card p, .install-banner p { font-size: 15px; line-height: 1.6; }
  .main-play .actions > .btn, .bottom-panel .actions > .btn, .mode-card .actions > .btn { flex: 1 1 auto; }
  .journey-card { gap: 15px; padding: 22px; }
  .journey-card img { width: 75px; flex-shrink: 0; }
  .reward-caption p, .stage small, .wine-coupon { font-size: 12px; }
  .reward-tile { grid-template-columns: 85px minmax(0, 1fr); padding: 20px 16px; }
  .reward-tile h3 { font-size: 19px; }
  .reward-visual { height: 120px; }
  .bottom-panel h2, .panel h2 { font-size: 30px; }
  .page-header h1 { font-size: clamp(34px, 9vw, 42px); }
  .stat-grid { grid-template-columns: 1fr; gap: 10px; }
  .stat-card { padding: 16px 18px; display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 14px; }
  .stat-card small { font-size: 11px; }
  .stat-card strong { grid-column: 2; grid-row: 1 / 3; font-size: 30px; margin: 0; }
  .stat-card span { font-size: 13px; }
  .compact-wines { display: grid; grid-template-columns: minmax(0, 1fr); }
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
  .dashboard-grid > .panel { min-width: 0; }
  .dashboard > .review-note { flex-wrap: wrap; }
  .dashboard > .review-note > .btn { width: 100%; }
  .leader-row { display: grid; grid-template-columns: 21px minmax(0, 1fr); gap: 5px 10px; }
  .leader-row > span { min-width: 0; overflow-wrap: anywhere; }
  .leader-row .leader-points { grid-column: 2; margin-left: 0; font-size: 12px; }
  .compact-wine { padding: 14px; gap: 14px; }
  .compact-wine > div { min-width: 0; overflow-wrap: anywhere; }
  .compact-wine strong { font-size: 14px; }
  .compact-wine span { font-size: 12px; }
  .stage { grid-template-columns: 37px minmax(0, 1fr); }
  .stage > button { grid-column: 1 / -1; width: 100%; }
  .wine-copy .eyebrow { font-size: 10px; }
  .wine-grid { grid-template-columns: minmax(0, 1fr); }
  .mode-variations { grid-template-columns: 1fr; }
  .mode-variation b { font-size: 15px; }
  .mode-variation p { font-size: 14px; }
  .site-footer { padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
  .site-footer button { font-size: 14px; min-height: 46px; }
  .site-footer > p { font-size: 12px; }

  /* One scroll surface per dialog, including when the on-screen keyboard opens. */
  #experience-modal, #experience-modal[data-appearance="recap"] {
    width: calc(100% - 16px); max-width: 600px;
    max-height: calc(var(--review-visible-height, 100dvh) - 16px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    top: calc(var(--review-visible-top, 0px) + env(safe-area-inset-top, 0px)); bottom: auto;
    margin: 8px auto; border-radius: 16px; overscroll-behavior: contain;
    scroll-padding: 20px; -webkit-overflow-scrolling: touch;
  }
  .modal-inner, .modal-inner.center, .round-recap { padding: 34px 22px calc(24px + env(safe-area-inset-bottom, 0px)); }
  .ppl-dialog { width: calc(100% - 16px); max-width: 600px; max-height: calc(var(--review-visible-height, 100dvh) - 16px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); top: calc(var(--review-visible-top, 0px) + env(safe-area-inset-top, 0px)); bottom: auto; margin: 8px auto; }
  .modal-inner h2 { font-size: clamp(29px, 8.5vw, 36px); padding-right: 28px; }
  .modal-inner.center h2 { padding-right: 20px; padding-left: 20px; }
  .modal-inner > p, .recap-heading > p, .recap-list-intro, .recap-next p { font-size: 15px; line-height: 1.6; }
  .modal-inner label { font-size: 14px; }
  .checkbox-label { font-size: 13px !important; min-height: 48px; align-items: center; }
  .checkbox-label input { width: 22px; height: 22px; flex: 0 0 22px; }
  .modal-close { top: 8px; right: 8px; }
  .entry-panel .tutorial-scene { height: clamp(150px, 28svh, 220px); }
  .entry-panel .tutorial-caption strong { font-size: 23px; }
  .entry-panel .tutorial-caption span, .entry-panel .tutorial-status { font-size: 14px; }
  .recap-status { font-size: 12px; }
  .recap-heading { padding-right: 20px; }
  .round-recap .result-number { font-size: 13px; }
  .recap-scoreline, .recap-context { font-size: 13px; }
  .recap-list-heading { flex-wrap: wrap; gap: 6px; }
  .recap-list-heading h3 { font-size: 26px; }
  .recap-list-heading > span { font-size: 12px; }
  .round-recap .actual-recap-row { padding: 16px 12px; gap: 12px; }
  .recap-item-art { width: 60px; flex-basis: 60px; min-height: 70px; }
  .round-recap .actual-recap-row img { width: 54px; height: 60px; }
  .round-recap .actual-recap-row small { font-size: 10px; letter-spacing: .5px; }
  .round-recap .actual-recap-row h3 { font-size: 23px; }
  .round-recap .actual-recap-row p { font-size: 14px; line-height: 1.6; }
  .recap-outcome { font-size: 12px; }
  .round-save-banner { align-items: stretch; flex-direction: column; }
  .round-save-banner p { font-size: 13px; }
  .round-save-banner .btn { margin: 0; width: 100%; }

  /* The game receives the available screen, rather than a fixed tall iframe. */
  body:has(.game-layout) { height: var(--review-visible-height, 100dvh); min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
  body:has(.game-layout) .site-header { display: none; }
  body:has(.game-layout) .review-ribbon { flex: 0 0 auto; }
  body:has(.game-layout) #main { flex: 1; min-height: 0; }
  .game-layout { height: 100%; min-height: 0; padding: 0; }
  .engine-wrap { display: flex; flex-direction: column; height: 100%; max-width: 480px; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .engine-toolbar { flex: 0 0 auto; min-height: 52px; padding: 4px 12px; gap: 8px; }
  .engine-toolbar strong { font-size: 13px; }
  .engine-toolbar button { font-size: 13px; min-height: 44px; white-space: nowrap; }
  #game-frame { flex: 1; height: 0; min-height: 0; max-height: none; }
  .engine-loading { top: 52px; padding: 18px; }
  .engine-loading > div { padding: 12px; }
  .engine-loading h2 { font-size: 30px; }
  .engine-loading .loading-stage { font-size: 15px; }
  .engine-loading .loading-spinner { margin-bottom: 12px; }
  .engine-loading .loading-actions { margin-top: 18px; }
}

@media (max-width: 700px) and (max-height: 650px) {
  .modal-inner.center.entry-panel { padding: 24px 20px 20px; }
  .entry-panel .eyebrow { margin-bottom: 12px; }
  .entry-panel h2 { font-size: 28px; }
  .entry-panel .tutorial-scene { height: 120px; margin-block: 18px; }
  .entry-panel .tutorial-caption strong { font-size: 21px; }
  .entry-panel .tutorial-caption span { font-size: 13px; line-height: 1.4; }
  .entry-panel .age-logo { font-size: 32px; margin-bottom: 12px; }
  .entry-panel .age-icon { height: 56px; width: auto; margin: 12px auto; }
  .entry-panel:has(.age-logo) h2 { padding: 0; }
  .entry-panel:has(.age-logo) > p { margin-top: 14px; }
}

.phone-orientation { position: absolute; inset: 52px 0 0; z-index: 6; padding: 22px; background: var(--cream); display: grid; place-content: center; text-align: center; }
.phone-orientation h2 { font-size: 28px; }
.phone-orientation p { font-size: 15px; margin: 12px auto 18px; max-width: 320px; }
.phone-orientation .btn { justify-self: center; }
@media (max-height: 480px) and (orientation: landscape) and (max-width: 1000px) {
  body:has(.game-layout) { height: var(--review-visible-height, 100dvh); min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
  body:has(.game-layout) .review-ribbon { flex: 0 0 auto; }
  body:has(.game-layout) #main { flex: 1; min-height: 0; }
  body:has(.game-layout) .site-header, body:has(.game-layout) .game-notes { display: none; }
  body:has(.game-layout) .site-footer { display: none; }
  body:has(.game-layout) .game-layout { display: block; padding: 0; height: 100%; min-height: 0; }
  body:has(.game-layout) .engine-wrap { max-width: none; display: flex; flex-direction: column; height: 100%; border: 0; border-radius: 0; }
  body:has(.game-layout) .engine-toolbar { flex: 0 0 auto; min-height: 52px; }
  body:has(.game-layout) #game-frame { flex: 1; height: 0; min-height: 0; max-height: none; }
  #experience-modal { max-height: calc(var(--review-visible-height, 100dvh) - 16px); top: var(--review-visible-top, 0px); bottom: auto; margin: 8px auto; }
}
