/* Single-screen phone layout. All rules are mobile-only. */
.panel-bottom .mobile-details-button { display: none; }
@media (max-width: 850px) {
  html { height: 100%; overflow: hidden; }
  body { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; display: grid; grid-template-rows: 50px minmax(0, 1fr) 28px; }
  .topbar { height: 50px; min-height: 0; padding: 0 12px; gap: 12px; flex-wrap: nowrap; }
  .brand { width: 96px; flex: none; }
  .edition, .stage-corner { display: none; }
  .topnav { height: 100%; min-width: 0; flex: 1; width: auto; margin-left: auto; justify-content: space-between; gap: 8px; }
  .topnav button { font-size: 12px; min-height: 44px; white-space: nowrap; }
  .topnav #info-tab span { display: none; }
  .workspace { height: 100%; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; overflow: hidden; }
  .viewer { height: auto; min-height: 0; max-height: none; overflow: hidden; }
  .product-heading { top: 12px; left: 16px; right: 166px; }
  .product-heading .eyebrow { font-size: 10px; letter-spacing: .04em; line-height: 1.3; }
  .product-heading h1 { font-size: 24px; margin: 5px 0 3px; }
  .product-heading h1 span { font-size: 9px; margin: 4px 0 0 3px; }
  .product-heading p { margin: 0; font-size: 11px; line-height: 1.5; letter-spacing: .03em; }
  /* Identical canvas and hotspot rectangles keep screen projections aligned. */
  #scene, #hotspots, #scene-loading, #scene-error { inset: 88px 8px 22px; }
  #scene-error { padding: 8px; }
  #scene-error img { min-height: 0; max-height: 65%; width: auto; max-width: 100%; object-fit: contain; }
  #scene-error p { margin: 6px 0; font-size: 12px; }
  .view-controls { top: 8px; right: 10px; bottom: auto; left: auto; transform: none; width: 148px; max-width: none; padding: 3px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; background: #152733; backdrop-filter: none; }
  .view-controls button, .view-controls button:not(.view-button) { height: 34px; min-height: 34px; min-width: 0; padding: 0; font-size: 11px; }
  .view-controls button:not(.view-button) { font-size: 20px; }
  .view-controls .divider { display: none; }
  .gesture-hint { bottom: 4px; font-size: 11px; gap: 5px; line-height: 16px; color: #9db1bd; }
  .gesture-hint .key-hint, .gesture-hint .mouse-icon { display: none; }
  /* Duplicate video entry is available in the top nav and current-action row. */
  .reference-button { display: none; }
  .hotspot { width: 38px; height: 38px; padding: 0; justify-content: center; transform: translate(-19px, -19px); }
  .hotspot .pin { width: 20px; height: 20px; font-size: 10px; box-shadow: 0 0 0 2px #14263222; }
  .hotspot.selected .pin { box-shadow: 0 0 0 3px #bfd77618; }
  .hotspot .pin-text { display: none; }
  .control-panel { min-height: 0; border-left: 0; border-top: 1px solid var(--line); overflow: visible; display: block; }
  .panel-top { display: none; }
  .motion-list { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; padding: 0 8px; position: static; border: 0; background: #14232d; }
  .motion-item { height: 44px; min-height: 44px; padding: 0 2px; gap: 0; justify-content: center; border: 0; border-radius: 0; }
  .motion-item .name { font-size: 12px; white-space: nowrap; }
  .motion-item .num, .motion-item .row-value { display: none; }
  .motion-item.selected:before { left: 10px; right: 10px; top: auto; bottom: 0; width: auto; height: 2px; }
  .selected-control { display: grid; grid-template-columns: 38px minmax(0, 1fr) 38px; grid-template-rows: 28px 34px 16px 38px; gap: 3px 8px; padding: 8px 16px; margin: 0; border-top: 1px solid var(--line); }
  .control-caption, .motion-description, .source-note { display: none; }
  .value-line { grid-column: 1 / -1; grid-row: 1; margin: 0; gap: 10px; }
  .value-line h2 { font-size: 17px; }
  .value-line output { font-size: 25px; white-space: nowrap; }
  .value-line output span { font-size: 12px; }
  #motion-slider { grid-column: 1 / -1; grid-row: 2; align-self: center; width: 100%; height: 34px; margin: 0; border: 0; background: linear-gradient(to right, var(--accent) 0%, var(--accent) var(--progress, 50%), #344957 var(--progress, 50%), #344957 100%) center / 100% 3px no-repeat; touch-action: pan-y; }
  #motion-slider::-webkit-slider-thumb { width: 18px; height: 24px; }
  #motion-slider::-moz-range-thumb { width: 14px; height: 20px; }
  .range-labels { grid-column: 1 / -1; grid-row: 3; margin: 0; font-size: 11px; line-height: 16px; }
  .step-controls { display: contents; }
  .step-controls span { display: none; }
  .step-controls button { height: 38px; width: 38px; border: 1px solid #a2c0cd25; font-size: 20px; }
  #step-minus { grid-column: 1; grid-row: 4; }
  #step-plus { grid-column: 3; grid-row: 4; }
  .action-pair { grid-column: 2; grid-row: 4; height: 38px; margin: 0; gap: 8px; }
  .primary-action { min-height: 38px; font-size: 12px; gap: 7px; }
  .secondary-action { width: 55px; font-size: 12px; }
  .secondary-action span { margin-left: 3px; }
  .panel-bottom { display: flex; align-items: center; gap: 8px; margin: 0; padding: 0 16px 6px; }
  .panel-bottom > button, .panel-bottom #reset-all { display: flex; width: auto; height: 34px; min-height: 34px; flex: 1; align-items: center; justify-content: center; padding: 0; border: 0; font-size: 12px; white-space: nowrap; }
  .panel-bottom #tour-label { display: none; }
  .panel-bottom .mobile-details-button { display: flex; flex: none; width: 62px; border-left: 1px solid var(--line); }
  .statusbar { height: 28px; min-height: 0; padding: 0 12px; display: flex; flex-wrap: nowrap; gap: 8px; font-size: 10px; }
  .statusbar > span:first-child { min-width: 0; max-width: none; flex: 1; }
  #status-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .statusbar button { flex: none; margin-left: auto; font-size: 10px; min-height: 24px; }
  .footer-brand { display: none; }
  .mobile-motion-dialog { width: min(92vw, 460px); max-height: 75dvh; overflow: auto; padding: 0; color: var(--text); background: var(--panel); border: 1px solid #57707e; }
  .mobile-motion-dialog::backdrop { background: #071119aa; }
  .mobile-motion-dialog .dialog-top { padding: 16px; }
  .mobile-motion-dialog h2 { font-size: 20px; }
  .mobile-motion-dialog .mobile-details-body { padding: 0 18px 18px; font-size: 14px; line-height: 1.9; }
  .mobile-motion-dialog .mobile-details-body p { margin: 12px 0; }
  .film-dialog, .info-dialog { max-height: 90dvh; }
}
@media (max-width: 360px) {
  .topbar { padding: 0 10px; gap: 8px; }
  .brand { width: 84px; }
  .topnav { gap: 6px; }
  .topnav button { font-size: 11px; }
  .product-heading { left: 12px; right: 153px; }
  .product-heading .eyebrow { font-size: 9px; }
  .product-heading h1 { font-size: 21px; }
  .view-controls { width: 140px; right: 8px; }
  .motion-list { padding: 0 4px; }
  .motion-item .name { font-size: 11px; }
  .selected-control { padding-left: 12px; padding-right: 12px; gap: 3px 6px; }
}
@media (max-width: 850px) and (max-height: 600px) {
  body { grid-template-rows: 44px minmax(0, 1fr) 24px; }
  .topbar { height: 44px; }
  .statusbar { height: 24px; }
  .product-heading .eyebrow { display: none; }
  .product-heading { top: 8px; }
  .view-controls { top: 2px; }
  #scene, #hotspots, #scene-loading, #scene-error { top: 78px; bottom: 16px; }
  .gesture-hint { font-size: 10px; bottom: 0; }
}
@media (max-width: 850px) and (orientation: landscape) {
  .workspace { grid-template-columns: minmax(0, 1fr) 276px; grid-template-rows: minmax(0, 1fr); }
  .control-panel { border-left: 1px solid var(--line); border-top: 0; align-self: center; max-height: 100%; overflow-y: auto; }
  .selected-control { padding-left: 10px; padding-right: 10px; gap: 3px 5px; grid-template-columns: 34px minmax(0, 1fr) 34px; }
  .step-controls button { width: 34px; }
  .motion-item .name { font-size: 11px; }
  .motion-list { padding: 0 3px; }
  .panel-bottom { padding-left: 8px; padding-right: 8px; gap: 3px; }
}
