.orientation-guard { display: none; }

@media (orientation: landscape) and (max-width: 1000px),
       (orientation: landscape) and (max-height: 560px) {
  :root {
    --safe-top: max(8px, env(safe-area-inset-top));
    --safe-right: max(14px, calc(env(safe-area-inset-right) + 8px));
    --safe-bottom: max(8px, env(safe-area-inset-bottom));
    --safe-left: max(14px, calc(env(safe-area-inset-left) + 8px));
  }

  html,
  body,
  .home,
  .journey-transition,
  .modal {
    width: 100%;
    height: 100dvh;
    min-height: 0;
  }

  .home--visual-master {
    --edge-left: var(--safe-left);
    --edge-right: var(--safe-right);
  }

  .home--visual-master .home__portrait img,
  .home--visual-master .home__idle-video {
    object-position: 52% 14%;
  }

  .home--visual-master .topbar {
    top: var(--safe-top);
    height: 48px;
  }

  .home--visual-master .profile-entry {
    min-width: 124px;
    min-height: 48px;
  }

  .home--visual-master .topbar-right,
  .home--visual-master .currency-wallet,
  .home--visual-master .topbar-actions {
    gap: 8px;
  }

  .home--visual-master .currency-pill {
    flex-basis: 104px;
    min-width: 104px;
    min-height: 44px;
    height: 44px;
  }

  .home--visual-master .utility-entry {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
  }

  .home--visual-master .service-entries {
    top: calc(var(--safe-top) + 64px);
    width: 156px;
    gap: 8px;
  }

  .home--visual-master .service-entries__eyebrow { display: none; }

  .home--visual-master .service-entry {
    min-height: 44px;
    height: 44px;
    grid-template-columns: 28px minmax(0, 1fr) 16px;
    gap: 7px;
    padding: 4px 7px;
    border-radius: 6px;
  }

  .home--visual-master .service-entry__icon {
    width: 28px;
    height: 28px;
  }

  .home--visual-master .service-entry__copy strong {
    font-size: 13px;
    line-height: 1.2;
  }

  .home--visual-master .service-entry__arrow {
    font-size: 16px;
    text-align: center;
  }

  .home--visual-master .right-feature-stack {
    top: calc(var(--safe-top) + 64px);
    gap: 8px;
  }

  .home--visual-master .feature-float {
    width: 144px;
    height: 44px;
    min-height: 44px;
    grid-template-columns: 26px minmax(0, 1fr);
    gap: 8px;
    padding: 5px 8px;
  }

  .home--visual-master .feature-float__icon {
    width: 26px;
    height: 26px;
  }

  .home--visual-master .feature-float__copy strong { font-size: 13px; }

  .home--visual-master .companion-line {
    right: var(--edge-right);
    bottom: calc(var(--safe-bottom) + 68px);
    width: min(456px, 52vw);
    min-height: 48px;
    padding: 8px 12px 8px 16px;
  }

  .home--visual-master .companion-name {
    display: inline;
    font-size: 13px;
  }

  .home--visual-master .companion-quote {
    overflow: hidden;
    font-size: 13px;
    line-height: 1.5;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .home--visual-master .bottom-actions {
    bottom: var(--safe-bottom);
    gap: 16px;
  }

  .home--visual-master .bottom-shortcuts { gap: 0; }

  .home--visual-master .heart-entry + .heart-entry { margin-left: 8px; }

  .home--visual-master .heart-entry {
    min-width: 96px;
    min-height: 56px;
    padding-inline: 10px;
  }

  .home--visual-master .entry-icon {
    width: 20px;
    height: 20px;
  }

  .home--visual-master .entry-label strong {
    font-size: 15px;
    line-height: 1.2;
  }

  .home--visual-master .continue-button {
    width: min(252px, 34vw);
    min-height: 56px;
    grid-template-columns: 38px minmax(0, 1fr) 42px;
  }

  .home--visual-master .continue-copy small {
    display: block;
    font-size: 8.5px;
    line-height: 1.2;
    letter-spacing: .12em;
  }

  .home--visual-master .continue-copy strong {
    margin-top: 4px;
    font-size: 17px;
    line-height: 1.2;
  }

  .unlock-toast {
    top: calc(var(--safe-top) + 58px);
    max-width: min(320px, 52vw);
  }

  .journey-transition {
    min-height: 0;
    padding:
      calc(env(safe-area-inset-top) + 24px)
      calc(env(safe-area-inset-right) + 24px)
      calc(env(safe-area-inset-bottom) + 24px)
      calc(env(safe-area-inset-left) + 24px);
  }

  .modal {
    place-items: stretch;
    padding:
      max(12px, calc(env(safe-area-inset-top) + 8px))
      max(14px, calc(env(safe-area-inset-right) + 8px))
      max(12px, calc(env(safe-area-inset-bottom) + 8px))
      max(14px, calc(env(safe-area-inset-left) + 8px));
  }

  .modal.profile-mode .modal__panel {
    width: 100%;
    max-width: none;
    max-height: none;
    display: grid;
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
    border-radius: 8px;
  }

  .modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
  }

  .panel-content {
    height: 100%;
    max-height: 100%;
    min-height: 0;
    padding: 16px 64px 20px 16px;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  .panel-cap {
    font-size: 8.5px;
    line-height: 1.2;
  }

  .profile-heading {
    grid-template-columns: 52px minmax(150px, 1fr) minmax(176px, 210px);
    gap: 12px;
    padding-bottom: 12px;
  }

  .profile-heading .profile-mark {
    width: 52px;
    font-size: 20px;
  }

  .profile-identity h2 {
    margin: 3px 0 2px;
    font-size: 20px;
    line-height: 1.2;
  }

  .profile-status {
    display: grid;
    grid-template-columns: repeat(2, minmax(82px, 1fr));
    gap: 8px;
  }

  .profile-status div { padding: 6px 8px; }

  .personality-section,
  .shine-section { padding-top: 12px; }

  .section-heading {
    align-items: center;
    min-height: 44px;
    margin-bottom: 8px;
  }

  .section-heading h3 { font-size: 16px; }

  .personality-radar,
  .radar-stage { min-height: 196px; }

  .radar-stage { grid-template-columns: minmax(0, 1fr) 178px; }

  .radar-chart { height: 194px; }

  .radar-summary {
    min-height: 160px;
    padding: 12px 14px;
  }

  .shine-empty { min-height: 56px; }
}

@media (orientation: landscape) and (max-width: 780px),
       (orientation: landscape) and (max-height: 390px) {
  .home--visual-master .profile-entry { min-width: 112px; }
  .home--visual-master .service-entries { width: 156px; }
  .home--visual-master .service-entry {
    min-height: 44px;
    grid-template-columns: 28px minmax(0, 1fr) 18px;
  }
  .home--visual-master .service-entry__icon { width: 28px; height: 28px; }
  .home--visual-master .service-entry__copy strong { font-size: 13px; }
  .home--visual-master .right-feature-stack { top: calc(var(--safe-top) + 60px); }
  .home--visual-master .feature-float { width: 144px; }
  .home--visual-master .companion-line { width: min(420px, 53vw); }
  .home--visual-master .continue-copy small { display: none; }
  .home--visual-master .continue-copy strong { margin-top: 0; }
  .panel-content { padding-top: 12px; }
  .profile-status dt { font-size: 8px; }
  .profile-status dd { font-size: 12px; }
  .radar-stage { grid-template-columns: minmax(0, 1fr) 160px; }
  .radar-summary > p,
  .radar-summary em { display: block; }
}

@media (orientation: portrait), (max-aspect-ratio: 1/1) {
  .orientation-guard {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 16px;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    padding:
      max(24px, env(safe-area-inset-top))
      max(24px, env(safe-area-inset-right))
      max(24px, env(safe-area-inset-bottom))
      max(24px, env(safe-area-inset-left));
    background: #08080c;
    color: var(--text);
    text-align: center;
    pointer-events: auto;
  }

  .orientation-guard span { color: var(--gold); font-size: 42px; }
  .orientation-guard strong { font-size: 18px; font-weight: 600; }
}

/* Five service entries keep their 44px targets and 8px gaps above navigation. */
@media (orientation: landscape) and (max-height: 380px) {
  .home--visual-master .service-entries { top: calc(var(--safe-top) + 48px); }
}
