/* Hamrah Android UX R1 — Android-scoped motion, geometry and density. */
html[data-android-ux-r1="true"] {
  --motion-press: 90ms;
  --motion-fast: 130ms;
  --motion-menu: 170ms;
  --motion-tab: 195ms;
  --motion-panel: 250ms;
  --ease-out-ui: cubic-bezier(.2,.8,.2,1);
  --ease-in-ui: cubic-bezier(.4,0,1,1);
}

@media (max-width: 899px) {
  /* Group 7 WAAPI is the sole chat route animator on Android. */
  html[data-android-ux-r1="true"] .chat-screen.opening,
  html[data-android-ux-r1="true"] .chat-screen.closing {
    animation: none !important;
  }

  html[data-android-ux-r1="true"] #messageList {
    scroll-behavior: auto;
    overflow-anchor: auto;
    touch-action: pan-y;
    overscroll-behavior-y: contain;
  }

  html[data-android-ux-r1="true"] #chatScreen .g115a-dev2b-floating-stack {
    inset-inline-end: max(10px, env(safe-area-inset-right));
    bottom: var(--android-bottom-control-offset, calc(82px + env(safe-area-inset-bottom)));
    gap: 8px;
  }

  html[data-android-ux-r1="true"] #g115aDev2bNewMessages {
    inline-size: 44px;
    block-size: 44px;
    border: 0;
    box-shadow: 0 5px 16px rgba(0,0,0,.24);
    transition: opacity var(--motion-fast) ease, transform var(--motion-fast) var(--ease-out-ui);
  }

  /* Keep the selected message in context: Android message actions are an
     anchored compact popover, not a generic full-width bottom sheet. */
  html[data-android-ux-r1="true"] .hup-layer.hup-mode-menu {
    display: block !important;
    padding: 0;
    background: rgba(2,8,14,.18);
    pointer-events: auto;
  }

  html[data-android-ux-r1="true"] .hup-mode-menu .hup-menu {
    width: min(calc(100vw - 24px), 304px);
    max-height: calc(var(--android-visible-viewport-height, 100dvh) - 24px);
    padding: 5px;
    border: 0;
    border-radius: 16px;
    background: color-mix(in srgb, var(--surface) 97%, var(--primary) 3%);
    box-shadow: 0 12px 34px rgba(0,0,0,.34);
    animation-duration: var(--motion-menu);
  }

  html[data-android-ux-r1="true"] .hup-mode-menu .hup-actions > button {
    min-height: 48px;
    padding: 5px 9px;
    border-radius: 11px;
    font-size: 13px;
    touch-action: manipulation;
  }

  html[data-android-ux-r1="true"] .hup-mode-menu .hup-reactions {
    gap: 2px;
    padding: 3px 2px 7px;
  }

  html[data-android-ux-r1="true"] .hup-mode-menu .hup-reactions button {
    inline-size: 44px;
    block-size: 44px;
    border-radius: 12px;
    font-size: 22px;
  }

  /* Full-height, phone-native information surfaces. */
  html[data-android-ux-r1="true"] #groupManageSheet {
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
    background: var(--surface);
    backdrop-filter: none;
  }

  html[data-android-ux-r1="true"] #groupManageSheet > .sheet.group-manage-sheet,
  html[data-android-ux-r1="true"] .pc-layer > .pc-panel {
    inline-size: 100%;
    min-inline-size: 0;
    max-inline-size: none;
    block-size: var(--android-visible-viewport-height, 100dvh);
    max-block-size: var(--android-visible-viewport-height, 100dvh);
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    animation-duration: var(--motion-panel);
    animation-timing-function: var(--ease-out-ui);
  }

  html[data-android-ux-r1="true"] .g104-info-tabs,
  html[data-android-ux-r1="true"] .pc-tabs,
  html[data-android-ux-r1="true"] .hsc-tabs {
    min-block-size: 48px;
    scrollbar-width: none;
  }

  html[data-android-ux-r1="true"] .g104-info-tabs button,
  html[data-android-ux-r1="true"] .pc-tabs button,
  html[data-android-ux-r1="true"] .hsc-tabs button {
    min-block-size: 44px;
    transition-duration: var(--motion-tab);
    touch-action: manipulation;
  }

  html[data-android-ux-r1="true"] .hsc-host[data-hsc-direction] .hsc-results > *,
  html[data-android-ux-r1="true"] #groupManageContent[data-info-direction] [data-group-info-panel]:not(.hidden),
  html[data-android-ux-r1="true"] .pc-shared-content[data-pc-direction] > * {
    animation: none !important;
  }

  /* Compact voice rows; the waveform remains the primary visual. */
  html[data-android-ux-r1="true"] .hsc-audio-row {
    min-height: 72px;
    contain-intrinsic-block-size: 72px;
  }

  html[data-android-ux-r1="true"] .voice-core-ui {
    grid-template-columns: 40px minmax(0,1fr) auto;
    gap: 7px;
    min-height: 48px;
  }

  html[data-android-ux-r1="true"] .voice-core-play {
    inline-size: 40px;
    block-size: 40px;
  }

  html[data-android-ux-r1="true"] .voice-core-rate {
    min-inline-size: 34px;
    block-size: 32px;
    border-radius: 10px;
    font-size: 11px;
  }

  html[data-android-ux-r1="true"] .voice-player.voice-core-host,
  html[data-android-ux-r1="true"] .voice-player[data-audio-player] {
    min-inline-size: 0;
    inline-size: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  html[data-android-ux-r1="true"] *,
  html[data-android-ux-r1="true"] *::before,
  html[data-android-ux-r1="true"] *::after {
    scroll-behavior: auto !important;
  }
}
