/* Main H5 desktop layout. Touch/mobile and the /v/ exhibition entry keep their own layouts.
   Kept separate from the application bundles so a visual release can be deployed alone. */
@media screen and (min-width: 1024px) and (orientation: landscape) and (hover: hover) and (pointer: fine) {
  #app .app-layout {
    --h5-content-width: 1320px;
    --h5-nav-height: 72px;
    display: flex;
    flex-direction: column;
    padding-bottom: 0;
  }

  /* Reuse the three existing destinations as a compact desktop header. */
  #app .app-layout .bottom-nav {
    position: sticky;
    order: -1;
    flex-shrink: 0;
    top: 0;
    bottom: auto;
    height: var(--h5-nav-height);
    min-height: 0;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 0 max(32px, calc((100vw - var(--h5-content-width)) / 2));
    border-top: 0;
    border-bottom: 1px solid var(--salon-border);
  }
  #app .app-layout .bottom-nav::before {
    content: "发知发 · AI换发";
    margin-right: auto;
    color: var(--salon-text);
    font-family: var(--font-display);
    font-size: 21px;
    font-weight: 600;
    letter-spacing: .02em;
  }
  #app .app-layout .bottom-nav .nav-item {
    flex: 0 0 104px;
    flex-direction: row;
    min-height: 44px;
    gap: 9px;
    padding: 10px 20px;
    border-radius: 12px;
  }
  #app .app-layout .bottom-nav .nav-item span { font-size: 14px; }
  #app .app-layout .bottom-nav .nav-item.active { background: var(--salon-gold-tint); }
  #app .app-layout .bottom-nav .nav-item.active span::before { display: none; }
  #app .app-layout .bottom-nav .nav-icon { width: 17px; height: 17px; }
  #app .app-layout .icp-footer { padding: 20px 32px; }

  #app .app-layout .home-page {
    min-height: calc(100vh - var(--h5-nav-height));
    padding: 28px 32px;
  }
  #app .app-layout .home-page :is(.start-view, .capture-view, .photo-confirm-view, .selection-view, .result-view) {
    width: 100%;
    max-width: var(--h5-content-width);
  }

  /* Introduction and real before/after examples share the first desktop row. */
  #app .app-layout .home-page .start-view {
    display: grid;
    grid-template-columns: minmax(0, .85fr) minmax(0, 1.25fr);
    grid-template-areas: "brand brand" "intro examples" "steps examples" "styles styles" "note note";
    gap: 24px 40px;
  }
  #app .app-layout .start-view > .brand-row { grid-area: brand; margin: 0; padding: 0; }
  #app .app-layout .start-view .brand-mark { font-size: 16px; color: var(--salon-muted); }
  #app .app-layout .start-view > .hero-card {
    grid-area: intro;
    align-self: center;
    padding: 20px 0 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
  }
  #app .app-layout .start-view .hero-copy h2 { font-size: clamp(32px, 2.8vw, 46px); line-height: 1.3; letter-spacing: -.03em; }
  #app .app-layout .start-view .hero-copy h2 span { display: block; font: inherit; color: inherit; margin-top: 4px; }
  #app .app-layout .start-view .hero-desc { max-width: 420px; margin-top: 20px; font-size: 15px; line-height: 1.9; }
  #app .app-layout .start-view .hero-actions { max-width: 360px; margin-top: 28px; gap: 12px; }
  #app .app-layout .start-view .hero-actions > button { min-height: 50px; }
  #app .app-layout .start-view > .flow-strip { grid-area: steps; align-self: end; margin: 0; padding: 18px 10px; }
  #app .app-layout .start-view > .effect-showcase { grid-area: examples; margin: 0; padding: 24px; min-width: 0; }
  #app .app-layout .start-view > .showcase-section:not(.effect-showcase) { grid-area: styles; margin: 6px 0 0; padding: 24px; min-width: 0; }
  #app .app-layout .start-view > .safety-note { grid-area: note; margin: 0; padding-top: 18px; }
  #app .app-layout .start-view .showcase-head h3 { font-size: 21px; }
  #app .app-layout .start-view .showcase-head p { font-size: 13px; }
  #app .app-layout .start-view .effect-marquee { margin-top: 20px; border-radius: 16px; }
  #app .app-layout .start-view .effect-card { flex-basis: clamp(460px, 42vw, 680px); min-height: 0; }
  #app .app-layout .start-view .effect-card img { height: clamp(300px, 27vw, 420px); object-fit: cover; }
  #app .app-layout .start-view .hair-scroll { gap: 16px; margin-top: 20px; padding-bottom: 12px; }
  #app .app-layout .start-view .hair-card-mini { flex-basis: calc((100% - 80px) / 6); min-width: 148px; }
  #app .app-layout .start-view .hair-card-mini strong { padding: 14px 14px 4px; font-size: 14px; }
  #app .app-layout .start-view .hair-card-mini small { padding: 0 14px 14px; font-size: 12px; }

  /* Camera and photo confirmation: independent picture and controls, no fixed dock over the image. */
  #app .app-layout .home-page :is(.capture-view, .photo-confirm-view) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
    grid-template-rows: auto 1fr;
    gap: 20px 40px;
    max-width: 1120px;
    min-height: 0;
    padding: 0;
  }
  #app .app-layout .home-page :is(.capture-view, .photo-confirm-view, .result-view) > .nav-bar {
    grid-column: 1 / -1;
    margin: 0;
    padding: 0 0 12px;
    border-bottom: 1px solid var(--salon-border);
  }
  #app .app-layout .home-page .nav-center { font-size: 19px; }
  #app .app-layout .capture-view .camera-shell,
  #app .app-layout .photo-confirm-view .portrait-frame {
    height: min(720px, calc(100vh - 196px));
    min-height: 360px;
    margin: 0;
    aspect-ratio: auto;
  }
  #app .app-layout .capture-view .video-element,
  #app .app-layout .photo-confirm-view .portrait-frame img { object-fit: contain; }
  #app .app-layout .capture-view .camera-shell { background: #24211f; }
  #app .app-layout .capture-view .capture-controls {
    position: static;
    align-self: center;
    width: 100%;
    max-width: none;
    grid-template-columns: 70px minmax(72px, 1fr) 70px;
    gap: 16px;
    margin: 0;
    padding: 28px 20px;
    background: var(--salon-surface);
    box-shadow: var(--shadow-sm);
  }
  #app .app-layout .capture-view .shutter { width: 76px; height: 76px; border-width: 3px; }
  #app .app-layout .home-page .photo-confirm-view { grid-template-rows: auto 1fr 1fr; }
  #app .app-layout .photo-confirm-view .portrait-frame { grid-row: 2 / 4; }
  #app .app-layout .photo-confirm-view .confirm-copy { align-self: end; margin: 0; }
  #app .app-layout .photo-confirm-view .confirm-copy h2 { font-size: 30px; }
  #app .app-layout .photo-confirm-view .confirm-copy p { margin-top: 16px; font-size: 15px; line-height: 1.8; }
  #app .app-layout .photo-confirm-view .bottom-actions.inline {
    position: static;
    align-self: start;
    width: 100%;
    max-width: none;
    margin: 8px 0 0;
    padding: 0;
    gap: 12px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
  }

  /* A full portrait alongside a scrollable catalogue; actions occupy their own row. */
  #app .app-layout .home-page.is-selection {
    display: block;
    height: calc(100vh - var(--h5-nav-height));
    min-height: 620px;
    max-height: none;
    padding: 24px 32px;
    overflow: visible;
  }
  #app .app-layout .home-page .selection-view {
    --h5-photo-width: 34%;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    height: 100%;
    gap: 16px;
    padding: 0;
    overflow: visible;
  }
  #app .app-layout .selection-view .selection-layout {
    grid-template-columns: var(--h5-photo-width) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    gap: 24px;
  }
  #app .app-layout .selection-view .photo-side { height: 100%; min-height: 0; border-radius: 24px; }
  #app .app-layout .selection-view .photo-side img { object-fit: contain; }
  #app .app-layout .selection-view .photo-back { top: 16px; left: 16px; min-height: 44px; padding: 0 18px; }
  #app .app-layout .selection-view .photo-side > span { bottom: 16px; right: 16px; font-size: 12px; padding: 7px 12px; }
  #app .app-layout .selection-view .drawer-panel { padding: 20px 22px 0; border-radius: 24px; }
  #app .app-layout .selection-view .drawer-head { margin-bottom: 16px; }
  #app .app-layout .selection-view .drawer-head-main { flex-wrap: wrap; gap: 8px 14px; }
  #app .app-layout .selection-view .drawer-head h3 { font-size: 21px; }
  #app .app-layout .selection-view .drawer-hint { flex-basis: 100%; font-size: 13px; }
  #app .app-layout .selection-view .text-btn { min-height: 40px; padding: 8px; font-size: 13px; }
  #app .app-layout .selection-view .filter-section { gap: 12px; margin-bottom: 9px; align-items: flex-start; }
  #app .app-layout .selection-view .filter-label { padding-top: 9px; font-size: 12px; }
  #app .app-layout .selection-view .filter-group { flex-wrap: wrap; gap: 7px; overflow: visible; }
  #app .app-layout .selection-view .filter-group.is-seg { gap: 0; }
  #app .app-layout .selection-view .chip { min-height: 34px; padding: 6px 13px; font-size: 13px; }
  #app .app-layout .selection-view .filter-group.is-seg .chip { min-height: 30px; }
  #app .app-layout .selection-view .style-scroll { padding: 4px 10px 0 3px; }
  #app .app-layout .selection-view .style-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding-bottom: 20px; }
  #app .app-layout .selection-view .style-img { aspect-ratio: 3 / 4; max-height: clamp(150px, calc(100vh - 520px), 340px); }
  #app .app-layout .selection-view .style-card small { display: block; }
  #app .app-layout .selection-view .style-card strong { font-size: 14px; }
  #app .app-layout .selection-view .generate-bar {
    position: static;
    width: calc(100% - var(--h5-photo-width) - 24px);
    max-width: none;
    margin: 0 0 0 auto;
    padding: 12px 16px;
    gap: 20px;
    background: var(--salon-surface);
    box-shadow: var(--shadow-sm);
  }
  #app .app-layout .selection-view .generate-bar .gold-btn { min-height: 48px; font-size: 16px; }
  #app .app-layout .selection-view .beauty-toggle { min-width: 72px; gap: 6px; }

  /* Result comparison stays large; save / retry / store actions remain beside it. */
  #app .app-layout .home-page.is-result { display: block; height: auto; padding: 24px 32px; }
  #app .app-layout .home-page .result-view {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    grid-template-rows: auto 1fr;
    gap: 24px 32px;
    padding: 0;
  }
  #app .app-layout .result-view .compare-card { height: min(800px, calc(100vh - 196px)); min-height: 400px; padding: 16px; }
  #app .app-layout .result-view .compare-stage { min-height: 0; }
  #app .app-layout .result-view .result-meta { padding: 8px 2px 0; }
  #app .app-layout .result-view .result-meta strong { font-size: 18px; }
  #app .app-layout .result-view .result-meta p { font-size: 13px; line-height: 1.7; }
  #app .app-layout .result-view .result-dock { align-self: center; margin: 0; padding: 24px; gap: 16px; box-shadow: var(--shadow-sm); }
  #app .app-layout .result-view .result-dock-row { grid-template-columns: 1fr; gap: 12px; }
  #app .app-layout .result-view .result-dock-row .outline-btn { min-height: 48px; font-size: 14px; }
  #app .app-layout .result-view .store-cta,
  #app .app-layout .result-view .share-btn--reward { min-height: 68px; }

  /* The existing loading content uses the available width without changing its timing. */
  #app .app-layout .home-page .loading-screen { padding: 32px; overflow-y: auto; }
  #app .app-layout .loading-screen .loading-card {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(260px, 1fr);
    grid-template-rows: 1fr auto auto auto 1fr;
    align-items: center;
    column-gap: 40px;
    width: min(940px, 100%);
    max-width: none;
    margin: auto;
    padding: 32px;
    text-align: left;
  }
  #app .app-layout .loading-card .loading-carousel { grid-column: 1; grid-row: 1 / 6; width: 100%; height: min(560px, calc(100vh - 160px)); max-height: none; margin: 0; }
  #app .app-layout .loading-card .loading-carousel-dots { display: none; }
  #app .app-layout .loading-card .loading-title { grid-column: 2; grid-row: 1; align-self: end; margin: 0 0 24px; font-size: 25px; }
  #app .app-layout .loading-card .progress-meta { grid-column: 2; grid-row: 2; }
  #app .app-layout .loading-card .progress-bar { grid-column: 2; grid-row: 3; }
  #app .app-layout .loading-card .loading-lyrics { grid-column: 2; grid-row: 4; margin-top: 24px; }

  /* Secondary pages share the same readable desktop content width. */
  #app .app-layout .design-page {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 24px;
    width: min(100%, calc(var(--h5-content-width) + 64px));
    min-height: calc(100vh - var(--h5-nav-height) - 60px);
    margin: 0 auto;
    padding: 32px;
    align-content: center;
  }
  #app .app-layout .design-page .design-hero { grid-row: span 2; margin: 0; padding: 40px; display: flex; flex-direction: column; justify-content: center; }
  #app .app-layout .design-page .design-logo-img { width: 80%; max-width: 360px; margin-bottom: 24px; }
  #app .app-layout .design-page .page-card { margin: 0; padding: 28px; }
  #app .app-layout .design-page .hero-actions { max-width: 400px; width: 100%; margin: 0 auto 28px; }
  #app .app-layout .profile-page { max-width: 1184px; min-height: calc(100vh - var(--h5-nav-height)); padding: 32px; margin: 0 auto; }
  #app .app-layout .profile-page .profile-header { max-width: none; padding: 0 0 20px; }
  #app .app-layout .profile-page .profile-content { padding: 0; }
  #app .app-layout .profile-page .profile-section { max-width: none; }
  #app .app-layout .profile-page .info-card { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  #app .app-layout .profile-page .records-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
  #app .app-layout .profile-page .login-prompt { max-width: 640px; margin: 80px auto; padding: 48px; }

  /* Teleported H5 store panel. This selector is not used by the exhibition app. */
  body .store-drawer-mask .store-drawer {
    top: max(24px, calc((100vh - 720px) / 2));
    bottom: auto;
    width: min(880px, calc(100% - 64px));
    height: min(720px, calc(100vh - 48px));
    margin: 0 auto;
    border-radius: 24px;
  }
  body .store-drawer-mask .store-drawer-head { padding: 20px 28px; }
  body .store-drawer-mask .store-drawer-body { padding: 20px 28px; }

  /* Visible scrollbars make mouse browsing discoverable; hover never substitutes for selection. */
  #app .app-layout :is(.style-scroll, .hair-scroll),
  body .store-drawer-mask .store-drawer-body { scrollbar-width: thin; scrollbar-color: #c4b19f transparent; }
  #app .app-layout :is(.style-scroll, .hair-scroll)::-webkit-scrollbar,
  body .store-drawer-mask .store-drawer-body::-webkit-scrollbar { display: block; width: 8px; height: 8px; }
  #app .app-layout :is(.style-scroll, .hair-scroll)::-webkit-scrollbar-thumb,
  body .store-drawer-mask .store-drawer-body::-webkit-scrollbar-thumb { border-radius: 8px; background: #c4b19f; border: 2px solid var(--salon-surface); }
  #app .app-layout .bottom-nav .nav-item:hover { background: var(--salon-gold-tint); }
  #app .app-layout .home-page :is(.outline-btn, .secondary-btn):hover { border-color: var(--salon-accent); }
  #app .app-layout .home-page .style-card:hover { border-color: var(--salon-gold); }

  @media (min-width: 1500px) {
    #app .app-layout .selection-view .style-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  }
}
