/* RightsFlow Mobile, Tablet & Touch Responsive Layer */
html {
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
}

body {
  overflow-x: clip;
  max-width: 100%;
  min-height: 100dvh;
}

#root {
  min-height: 100dvh;
  max-width: 100%;
  overflow-x: clip;
}

/* Smooth touch signing on mobile canvases */
canvas {
  max-width: 100%;
  touch-action: none;
}

img,
svg,
video {
  max-width: 100%;
}

/* Mobile & small screens (<= 640px) */
@media (max-width: 640px) {
  /* Prevent iOS Safari zoom on input focus */
  input,
  select,
  textarea {
    font-size: 16px !important;
  }

  /* Keep headers and action rows wrapping cleanly instead of overflowing */
  #root header > div,
  #root nav {
    flex-wrap: wrap;
    row-gap: 8px;
  }

  /* Prevent long emails, share URLs or ISRC codes from breaking layout */
  #root a,
  #root code,
  #root p,
  #root span {
    overflow-wrap: break-word;
  }

  /* Make any wide tables horizontally scrollable without breaking page width */
  #root table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Legal footer mobile layout */
  .rf-legal-footer-inner {
    padding: 16px 14px calc(16px + env(safe-area-inset-bottom, 0px));
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .rf-legal-links {
    gap: 10px 14px;
  }

  .rf-legal-link {
    padding: 4px 0;
    font-size: 12.5px;
  }

  /* Cookie banner mobile layout */
  .rf-legal-banner {
    left: 10px;
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom, 10px));
    padding: 14px;
    border-radius: 12px;
  }

  .rf-legal-banner-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .rf-legal-btn {
    min-height: 42px;
    width: 100%;
    text-align: center;
  }

  /* Legal modal as mobile-friendly sheet */
  .rf-legal-modal {
    padding: 8px;
    align-items: flex-end;
  }

  .rf-legal-dialog {
    max-height: 90dvh;
    border-radius: 16px 16px 12px 12px;
  }

  .rf-legal-dialog-head {
    padding: 14px 16px;
  }

  .rf-legal-dialog-title {
    font-size: 15px;
  }

  .rf-legal-tabs {
    padding: 8px 14px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .rf-legal-tabs::-webkit-scrollbar {
    display: none;
  }

  .rf-legal-tab {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 8px 12px;
  }

  .rf-legal-dialog-body {
    padding: 14px 16px 18px;
    font-size: 13.5px;
  }

  .rf-legal-dialog-foot {
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    text-align: center;
  }
}

/* Tablet tweaks (641px - 1024px) */
@media (min-width: 641px) and (max-width: 1024px) {
  .rf-legal-footer-inner {
    padding: 16px 20px;
  }

  .rf-legal-dialog {
    max-width: 92vw;
    max-height: 86dvh;
  }
}
