/* v1.6 mobile usability refinements */

.preview {
  max-height: 100%;
  object-fit: contain;
}

@media (max-width: 980px) {
  body.detail-open,
  body.tinder-open {
    overflow: hidden;
  }

  .bar {
    padding: 10px 12px;
  }

  h1 {
    font-size: 18px;
  }

  .subtitle {
    font-size: 12px;
    line-height: 1.3;
  }

  .actions {
    gap: 6px;
  }

  .actions button {
    min-height: 40px;
    padding: 8px 10px;
    font-size: 13px;
  }

  main {
    padding: 10px;
  }

  .filters {
    gap: 6px;
    margin-bottom: 10px;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 3px;
    -webkit-overflow-scrolling: touch;
  }

  .chip {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 8px 10px;
    white-space: nowrap;
  }

  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .meta {
    padding: 8px;
  }

  .name {
    min-height: 0;
    font-size: 12px;
  }

  .tagline,
  .scoreline {
    font-size: 11px;
  }

  aside {
    height: 100dvh;
    grid-template-rows: clamp(150px, 32dvh, 260px) minmax(0, 1fr) !important;
    overflow: hidden;
  }

  .preview-wrap {
    height: auto !important;
    min-height: 0;
    overflow: hidden !important;
    background: #ebe3dc;
  }

  .preview {
    width: 100%;
    height: 100%;
    max-height: none !important;
    object-fit: contain;
    object-position: center top;
    background: #ebe3dc;
  }

  body.compact-detail-image aside {
    grid-template-rows: clamp(110px, 24dvh, 190px) minmax(0, 1fr) !important;
  }

  .review {
    min-height: 0;
    max-height: none !important;
    overflow: auto !important;
    padding: 8px 8px max(16px, env(safe-area-inset-bottom)) !important;
    -webkit-overflow-scrolling: touch;
  }

  .detail-close,
  .detail-nav {
    position: sticky;
    top: 0;
    z-index: 2;
  }

  .detail-close {
    min-height: 38px;
    margin-bottom: 6px !important;
    font-size: 13px;
  }

  .detail-nav {
    gap: 6px !important;
    margin-bottom: 8px !important;
    background: #fff;
  }

  .detail-nav button {
    min-height: 38px !important;
    padding: 7px 8px;
    font-size: 13px;
  }

  .review h2 {
    font-size: 17px;
    line-height: 1.15;
  }

  .review .desc {
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.25;
  }

  .summary {
    gap: 5px;
    margin-top: 8px;
  }

  .summary div {
    padding: 6px;
    font-size: 11px;
  }

  .summary strong {
    font-size: 16px;
  }

  .field {
    margin-top: 9px;
  }

  .field label {
    margin-bottom: 4px;
    font-size: 10px;
  }

  .rating {
    gap: 5px;
  }

  .rating button {
    min-height: 38px;
    padding: 7px 0;
  }

  .toggle-row input {
    width: 18px;
    height: 18px;
  }

  textarea {
    min-height: 72px;
    padding: 8px;
    font-size: 16px;
  }

  #syncPanel {
    bottom: max(8px, env(safe-area-inset-bottom));
  }

  body.detail-open #syncPanel,
  body.tinder-open #syncPanel {
    display: none;
  }

  .tinder-stage {
    padding: 8px 8px max(12px, env(safe-area-inset-bottom));
  }

  .tinder-card {
    max-height: calc(100dvh - 172px) !important;
  }

  .tinder-card img {
    max-height: calc(100dvh - 305px) !important;
  }
}

@media (max-width: 420px) and (max-height: 760px) {
  aside {
    grid-template-rows: clamp(118px, 26dvh, 190px) minmax(0, 1fr) !important;
  }

  body.compact-detail-image aside {
    grid-template-rows: clamp(90px, 20dvh, 150px) minmax(0, 1fr) !important;
  }

  .bar {
    padding: 8px;
  }

  .subtitle {
    display: none;
  }

  .review h2 {
    font-size: 16px;
  }

  .summary div {
    font-size: 10px;
  }

  .field {
    margin-top: 7px;
  }

  textarea {
    min-height: 58px;
  }
}
