:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --visual-viewport-height: 100dvh;
  --keyboard-inset: 0px;
}

html {
  min-block-size: 100%;
  scroll-padding-block: calc(var(--safe-top) + 5rem) calc(var(--safe-bottom) + 1.5rem);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-block-size: 100vh;
  min-block-size: var(--visual-viewport-height);
  padding-inline: var(--safe-left) var(--safe-right);
  -webkit-tap-highlight-color: transparent;
}

img, video, canvas, svg { max-inline-size: 100%; }
button, a, input, select, textarea { touch-action: manipulation; }
button, input, select, textarea { font: inherit; }

.hp-field {
  position: absolute !important;
  inline-size: 1px !important;
  block-size: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
  left: auto !important;
}

.site-header,
.owner-shell,
.customer-dashboard-shell {
  padding-inline-start: max(var(--safe-left), 0px);
  padding-inline-end: max(var(--safe-right), 0px);
}

.site-header { padding-block-start: var(--safe-top); }

.cart-drawer-panel,
.license-dialog,
[role="dialog"] {
  max-block-size: calc(var(--visual-viewport-height) - var(--safe-top) - var(--safe-bottom) - 1rem);
  overscroll-behavior: contain;
}

.cart-drawer-footer,
.modal-actions,
.owner-mobile-nav,
.customer-mobile-nav {
  padding-block-end: max(1rem, var(--safe-bottom));
}

:where(button, [role="button"], a, input, select, textarea):focus-visible {
  outline: 2px solid #f7c629;
  outline-offset: 3px;
}

@media (pointer: coarse), (max-width: 1024px) {
  :where(button, [role="button"], .btn, .auth-link, .nav-links a, input, select) {
    min-block-size: 44px;
  }

  input:not([type="range"]):not([type="checkbox"]):not([type="radio"]),
  select,
  textarea { font-size: max(16px, 1em); }

  .player-copy span,
  .player-status,
  .player-progress { font-size: 12px; }

  .site-nav,
  main,
  .site-footer {
    max-inline-size: 100%;
  }

  .license-dialog,
  .cart-drawer-panel {
    padding-block-end: max(1.25rem, var(--safe-bottom));
  }
}

@media (max-width: 430px) {
  .site-nav { padding-inline: clamp(.75rem, 4vw, 1.1rem); }
  .beats-main, main { min-inline-size: 0; }
  .button-row, .header-actions { flex-wrap: wrap; }
  .beats-player { inline-size: min(100%, calc(100vw - var(--safe-left) - var(--safe-right))); }
}

@media (orientation: landscape) and (max-height: 520px) {
  .license-dialog,
  .cart-drawer-panel,
  [role="dialog"] {
    max-block-size: calc(var(--visual-viewport-height) - var(--safe-top) - var(--safe-bottom) - .5rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  html:focus-within { scroll-behavior: auto; }
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .site-header, .license-dialog, .cart-drawer-panel { backdrop-filter: none !important; }
}

.beats-state.beats-empty {
  box-sizing: border-box;
  flex-direction: column;
  gap: 8px;
  max-inline-size: 100%;
  padding: clamp(22px, 5vw, 42px);
  line-height: 1.5;
}
.beats-state.beats-empty strong { color: var(--beats-text); font-size: clamp(1.05rem, 3vw, 1.35rem); }
.beats-state.beats-empty span { max-inline-size: 44ch; }

/* Grid children must be allowed to shrink to the real mobile content width. */
@media (max-width: 760px) {
  .section-head { grid-template-columns: minmax(0, 1fr); }
  .section-head > * {
    min-inline-size: 0;
    max-inline-size: 100%;
    overflow-wrap: anywhere;
  }
}
.beats-carousel > .beats-state.beats-empty { position: absolute; inset: 24px; min-block-size: 0; }

@media (max-width: 640px) {
  .beats-showcase.is-empty .carousel-shell { block-size: 430px; }
  .beats-showcase.is-empty .beats-carousel { block-size: 286px; }
  .beats-showcase.is-empty .beats-player { bottom: 8px; }
  .beats-carousel > .beats-state.beats-empty { inset: 20px 16px; }
}
