/* «Порівняти»: the tray at the bottom of the screen (public/js/compare.js) and the compare page (public/js/compare-page.js) */
.ctray {
  position: fixed; z-index: 45; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 10px;
  width: min(820px, calc(100% - 24px)); padding: 8px; border: 1px solid rgba(255, 255, 255, 0.65); border-radius: 24px;
  background: rgba(255, 255, 255, 0.9); -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px);
  box-shadow: 0 10px 36px rgba(15, 17, 20, 0.2); transform: translateX(-50%); animation: ctray-in 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
}
@keyframes ctray-in { from { transform: translate(-50%, 130%); } }
.ctray__cars { display: flex; flex: 1; gap: 6px; min-width: 0; }
.ctray__car, .ctray__slot { flex: 1 1 0; min-width: 0; min-height: 48px; border-radius: 16px; }
.ctray__car { display: flex; align-items: center; gap: 8px; padding: 4px; background: var(--mist); }
.ctray__car img { flex: none; width: 52px; height: 38px; border-radius: 12px; object-fit: cover; background: #e8e9eb; }
.ctray__car span { display: -webkit-box; flex: 1; min-width: 0; overflow: hidden; font-size: 12px; font-weight: 600; line-height: 1.25; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ctray__x { display: grid; flex: none; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.ctray__x:hover { background: var(--mist-2); color: var(--graphite); }
.ctray__x .i { width: 16px; height: 16px; }
.ctray__slot { border: 1.5px dashed var(--line); }
.ctray__go { flex: none; min-height: 48px; padding-inline: 20px; }
.ctray__clear { display: grid; flex: none; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: var(--mist); color: var(--graphite); cursor: pointer; }
.ctray__clear:hover { background: var(--mist-2); }
/* the AI assistant's pill (assistant.css) steps aside while the tray is up; the footer leaves room for the tray */
html.has-compare .ai { visibility: hidden; opacity: 0; translate: 0 24px; }
html.has-compare .ftr__legal { padding-bottom: 104px; }
html.is-locked .ctray { display: none; }
@media (max-width: 640px) {
  .ctray { bottom: calc(10px + env(safe-area-inset-bottom)); width: calc(100% - 20px); gap: 6px; padding: 6px; border-radius: 20px; }
  .ctray__car { position: relative; padding: 0; background: none; }
  .ctray__car img { width: 100%; height: 44px; }
  .ctray__car span { display: none; }
  .ctray__x { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; background: #fff; color: var(--graphite); box-shadow: 0 1px 4px rgba(15, 17, 20, 0.25); }
  .ctray__go { min-height: 44px; padding-inline: 14px; font-size: 14px; }
  .ctray__clear { width: 36px; height: 36px; }
}

/* ---------- the compare page ---------- */
.cmp-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; }
.cmp-wait [data-cmp] { min-height: 100vh; } /* the table is on its way (compare-page.js) */
.cmp-wait .cmp-empty { display: none; }
.cmp-head .is-off { visibility: hidden; } /* keeps its room while the table loads… */
html:not(.cmp-wait) .cmp-head__tools.is-off { display: none; } /* …but no cars to show: no room either */
.cmp-head__tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.cmp-diff { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; cursor: pointer; }
.cmp { --cols: 3; --label: 200px; padding-bottom: 96px; }
.cmp__cars, .cmp__row, .cmp__cta { display: grid; grid-template-columns: var(--label) repeat(var(--cols), minmax(0, 1fr)); gap: 12px; }
.cmp__cars > :first-child, .cmp__cta > :first-child { grid-column-start: 2; }
.cmp__cars {
  position: sticky; z-index: 5; top: 84px; padding-block: 10px; background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); transition: top 0.25s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.cmp__slot {
  position: relative; display: grid; grid-template-columns: 128px minmax(0, 1fr); grid-template-rows: auto auto 1fr; align-items: start; gap: 2px 12px;
  min-width: 0; padding: 10px 44px 10px 10px; border-radius: var(--r-md); background: var(--mist); animation: cmp-in 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
}
@keyframes cmp-in { from { opacity: 0; transform: translateY(12px); } }
.cmp__pic { display: block; grid-row: 1 / -1; aspect-ratio: 16 / 10; overflow: hidden; border-radius: 12px; background: #e8e9eb; }
.cmp__pic img { width: 100%; height: 100%; object-fit: cover; }
.cmp__pic.studio { background-position: 50% 53%; background-size: auto 222%; } /* as on the catalog card (site.css) */
.cmp__pic.studio img { padding-top: 12cqw; }
.cmp__pic.studio img[src^="/spin/"] { padding: 0; transform: scale(1.5); transform-origin: 50% 90%; } /* as on the catalog card */
.cmp__name { overflow: hidden; font-size: 16px; font-weight: 700; line-height: 1.25; text-decoration: none; text-overflow: ellipsis; }
.cmp__name:hover { text-decoration: underline; }
.cmp__slot small { color: var(--muted); font-size: 12px; }
.cmp__x { position: absolute; z-index: 1; top: 8px; right: 8px; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.94); color: var(--graphite); box-shadow: 0 1px 4px rgba(15, 17, 20, 0.15); cursor: pointer; }
.cmp__x:hover { background: #fff; }
.cmp__x .i { width: 18px; height: 18px; }
.cmp__add { display: grid; align-content: center; min-width: 0; padding: 12px; border: 1.5px dashed var(--line); border-radius: var(--r-md); }
.cmp__pick, .cmp__pick select { width: 100%; }

.cmp__group { margin-top: 28px; }
.cmp__group h2 { margin-bottom: 4px; color: var(--muted); font-size: 13px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.cmp__row { align-items: center; padding-block: 12px; border-bottom: 1px solid var(--line); }
.is-diff .cmp__row.is-same { display: none; }
.cmp__label { color: var(--muted); font-size: 14px; }
.cmp__label small { display: block; font-size: 12px; }
.cmp__val { display: grid; gap: 6px; min-width: 0; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cmp__val.is-none { color: var(--muted); font-weight: 500; }
.cmp__num { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.cmp__num small { color: var(--muted); font-size: 12px; font-weight: 600; }
.cmp__num em { padding: 2px 8px; border-radius: 999px; background: var(--ok-bg); color: var(--ok); font-size: 11px; font-style: normal; font-weight: 700; }
.cmp__bar { display: block; height: 6px; overflow: hidden; border-radius: 999px; background: var(--mist-2); }
.cmp__bar i { display: block; height: 100%; border-radius: inherit; background: var(--graphite); transform: scaleX(var(--w, 0)); transform-origin: left; transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1); }
@starting-style { .cmp:not(.is-quiet) .cmp__bar i { transform: scaleX(0); } } /* the bars grow in when cars come in */
.is-best .cmp__bar i { background: var(--ok); }
.cmp__cta { margin-top: 24px; }
.cmp__go { display: grid; align-content: start; gap: 8px; min-width: 0; }
.cmp__note { max-width: 90ch; margin-top: 32px; color: var(--muted); font-size: 12px; }
.cmp-empty { padding: 24px 0 8px; text-align: center; }
.cmp-empty h2 { font-size: 26px; }
.cmp-empty p { max-width: 46ch; margin: 10px auto 20px; color: var(--muted); }
.cmp-empty__cta { display: flex; justify-content: center; }
.cmp-empty__pick { max-width: 420px; margin: 16px auto 0; }

@media (max-width: 760px) {
  /* phones: each label is a line of its own above the values */
  .cmp__cars, .cmp__row, .cmp__cta { grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 8px; }
  .cmp__cars > :first-child, .cmp__cta > :first-child { grid-column-start: auto; }
  .cmp__label { grid-column: 1 / -1; }
  .cmp__cars { top: 72px; }
  .cmp__slot { grid-template-columns: minmax(0, 1fr); padding: 6px; }
  .cmp__pic { grid-row: auto; margin-bottom: 6px; }
  .cmp__name { font-size: 13px; }
  .cmp__slot small { display: none; }
  .cmp__x { top: 10px; right: 10px; width: 28px; height: 28px; }
  .cmp__add { padding: 6px; }
  .cmp__pick select { padding: 0 28px 0 10px; background-position: right 10px center; font-size: 12px; }
  .cmp__val { font-size: 14px; }
  .cmp__num em { width: 8px; height: 8px; padding: 0; overflow: hidden; border-radius: 50%; background: var(--ok); font-size: 0; align-self: center; } /* a green dot instead of the word */
  .cmp__go .btn { min-height: 40px; padding: 8px; font-size: 12px; white-space: normal; text-align: center; }
}
@media (max-width: 640px) {
  .cmp__cars { top: 68px; }
  .hdr.is-away ~ main .cmp__cars { top: 0; } /* the header slides away on the way down (site.js) */
}
