/* ── ALL DESKTOP OVERRIDES (≥601px) ──────────────────────────────────────── */
@media (min-width: 601px) {

  /* CARDS — bigger title, tags hidden (shown in desktop body instead) */
  #listContainer .ex-card .ex-card-main .ex-info { display: flex; flex-direction: row; align-items: flex-start; flex-wrap: wrap; gap: 0; }
  #listContainer .ex-card .ex-name { font-size: 24px; font-weight: 800; flex: 1; min-width: 0; }
  #listContainer .ex-card .ex-tags { display: none; }

  /* EXPANDED CARD PANELS — scale up content */
  .ex-panel-left  { padding: 14px 14px 14px 16px; }
  .ex-panel-mid   { padding: 14px 10px; }
  .ex-panel-right { padding: 14px 16px 14px 10px; }
  .ex-meta-kv-val { font-size: 13px; }
  .dual-diagram-inner { gap: 8px; }
  .ex-card-panels { grid-template-columns: 190px 1fr 170px; }
  .ex-diff-desktop { display: block; background: var(--surface3); padding: 8px 16px 6px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
  .ex-diff-mobile { display: none; }
  .results-count { font-size: 15px; }

  /* CARD EDIT BUTTON — show on hover */
  .ex-card:hover .card-edit-btn--quick { display: flex; }

  /* DRAWER DESKTOP LAYOUT */
  #exDrawer {
    left: 0; right: 0;
    width: min(600px, 92vw);
    margin-left: auto; margin-right: auto;
    height: 80vh;
    border-radius: 18px 18px 0 0;
  }
  #exDrawer.ex-drawer--closed  { transform: translateY(100%); }
  #exDrawer.ex-drawer--peek    { transform: translateY(calc(100% - var(--drawer-header-h))); }
  #exDrawer.ex-drawer--full    { transform: translateY(15vh); }
  #exDrawer.ex-drawer--dragging { transition: none !important; transform: translateY(var(--drawer-ty, 100%)); }

  /* Two-column panel layout: video left, sidebar right */
  #exDrawerPanels {
    display: grid;
    grid-template-columns: 1fr 200px;
    grid-template-rows: auto auto auto;
    gap: 0;
  }
  .ex-drawer-hero  { grid-column: 1 / -1; }
  .ex-drawer-video {
    grid-column: 1; grid-row: 2 / 4;
    border-bottom: none; border-right: 1px solid var(--border);
    padding: 16px 20px 20px;
    display: flex; align-items: flex-start;
  }
  .ex-drawer-video .ex-thumb-wrap { width: 100%; }
  .ex-drawer-chips {
    grid-column: 2; grid-row: 2 / 4;
    flex-direction: column; gap: 10px;
    border-bottom: none;
    padding: 14px 16px 16px;
    overflow-y: auto;
  }
  .ex-drawer-chip { flex: none; }
  .ex-drawer-chip__diagram-img { max-height: 110px; }
  .ex-drawer-diagrams { display: none; }

  /* DESKTOP SIDE PANEL */
  :root { --panel-w: 480px; }
  #exSidePanel { display: block; }

  /* When panel is open, list shrinks and panel slides in from right */
  body.panel-open #listContainer {
    margin-right: var(--panel-w);
    transition: margin-right 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    border-radius: 0 16px 16px 0;
    overflow: hidden;
  }
  body.panel-open header {
    padding-right: var(--panel-w);
    transition: padding-right 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    border-radius: 0 16px 0 0;
  }
  body.panel-open #backToTop {
    right: calc(var(--panel-w) + 16px);
  }
  /* Collapse icon-text buttons to icon-only when side panel compresses the header */
  body.panel-open .wilde-picks-btn,
  body.panel-open .dice-btn {
    width: 38px;
    padding: 0;
    gap: 0;
    font-size: 0;
    letter-spacing: 0;
  }
  body.panel-open .wilde-picks-btn svg {
    width: 16px;
    height: 16px;
  }
  header {
    transition: padding-right 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  }
  #listContainer {
    transition: margin-right 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  }

  .ex-side-panel {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: var(--panel-w);
    z-index: 200;
    background: linear-gradient(180deg, #252527 0%, #1e1e20 100%);
    border-left: 1px solid rgba(255,255,255,0.10);
    box-shadow: -8px 0 40px rgba(0,0,0,0.6), -2px 0 12px rgba(0,0,0,0.4), inset 1px 0 0 rgba(255,255,255,0.04);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    overflow: hidden;
  }
  .ex-side-panel--open {
    transform: translateX(0);
  }

  /* Drag-to-resize handle */
  .ex-side-panel__resize {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 6px;
    cursor: col-resize;
    z-index: 10;
    background: transparent;
    transition: background 0.15s;
  }
  .ex-side-panel__resize:hover,
  .ex-side-panel__resize.dragging {
    background: rgba(212,212,200,0.18);
  }

  .ex-side-panel__inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    padding-top: 0;
  }

  .ex-side-panel__close {
    position: absolute;
    top: 14px; right: 14px;
    width: 28px; height: 28px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 6px;
    color: var(--muted2);
    font-size: 13px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    z-index: 2;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    line-height: 1;
    padding: 0;
  }
  .ex-side-panel__close:hover {
    color: var(--text);
    border-color: rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.1);
  }

  .ex-side-panel__title {
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    background: linear-gradient(160deg, rgba(40,40,46,0.95) 0%, rgba(22,22,26,0.98) 100%);
    border-left: 3px solid transparent;
    box-shadow: 0 2px 12px rgba(0,0,0,0.35);
  }
  .ex-side-panel__title .ex-side-panel__name {
    font-size: 22px; font-weight: 700;
    font-family: 'Inter', sans-serif;
    letter-spacing: -0.025em; line-height: 1.2;
    color: var(--text);
    padding: 18px 50px 18px 20px;
  }
  .ex-side-panel__title .ex-name-paren { font-weight: 500; opacity: 0.58; }
  .ex-side-panel__title-tags {
    display: flex; gap: 5px; margin-top: 6px; flex-wrap: wrap;
    padding: 0 20px 14px;
  }
  /* Chips row moved to content — title-chips no longer used */
  .ex-side-panel__title-chips { display: none; }

  .ex-side-panel__content {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
    display: flex;
    flex-direction: column;
  }

  /* Reuse the drawer interior sections inside the side panel */
  #exSidePanelContent .ex-drawer-hero { background: rgba(0,0,0,0.2); }
  #exSidePanelContent .ex-drawer-video .ex-thumb-wrap { box-shadow: 0 4px 20px rgba(0,0,0,0.6); border-radius: 8px; }

  /* Panel grid layout — same as drawer desktop layout */
  #exSidePanelContent #exDrawerPanels {
    display: block;
  }
  #exSidePanelContent .ex-drawer-video {
    border-bottom: 1px solid var(--border);
    border-right: none;
    padding: 14px 20px;
    display: block;
  }
  /* Non-growing sections stay compact */
  #exSidePanelContent .ex-drawer-video,
  #exSidePanelContent .ex-drawer-diagrams,
  #exSidePanelContent .ex-drawer-hero { flex-shrink: 0; }

  /* Metadata: 3-column horizontal row, fills width, vertically centered in remaining space */
  #exSidePanelContent .ex-drawer-chips {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0;
    padding: 0;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    flex: 1;
    align-items: center;
  }
  #exSidePanelContent .ex-drawer-chip {
    flex: 1 1 0;
    min-width: 0;
    padding: 18px 20px;
    border-right: 1px solid rgba(255,255,255,0.07);
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-self: stretch;
    justify-content: center;
  }
  #exSidePanelContent .ex-drawer-chip:last-child { border-right: none; }
  #exSidePanelContent .ex-drawer-chip__label {
    font-size: 10px; font-weight: 600; letter-spacing: 0.1em;
    text-transform: uppercase; color: rgba(180,180,190,0.55);
    font-family: 'Inter', sans-serif;
  }
  #exSidePanelContent .ex-drawer-chip__val {
    font-size: 19px; font-weight: 700;
    font-family: 'Inter', sans-serif;
    letter-spacing: -0.015em; line-height: 1.2;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  #exSidePanelContent .ex-drawer-diagrams {
    display: flex;
    padding: 16px 20px 24px;
    border-bottom: none;
  }
  #exSidePanelContent .ex-drawer-diagrams .dual-diagram-inner { max-width: 240px; }
  /* Action row pinned to bottom */
  #exSidePanelContent .ex-drawer-queue-wrap {
    margin-top: auto;
    align-items: center;
    justify-content: center;
    padding: 32px 20px 20px;
  }
  #exSidePanelContent .ex-drawer-queue-btn {
    font-size: 16px;
    padding: 16px 32px;
    flex: none;
  }

  /* QUEUE BUTTON — show on cards that are in queue */
  .ex-card.in-queue .queue-btn { display: flex; color: var(--accent); border-color: var(--accent); }

  /* WORKOUT BAR — keep within list area when side panel is open */
  body.panel-open .workout-bar { right: var(--panel-w); }

  /* HEART PANEL — slides from right instead of bottom */
  .heart-panel__sheet {
    left: auto; right: 0; bottom: 0; top: 0; max-height: 100vh;
    width: 360px; border-radius: 0; border-left: 1px solid var(--border2);
    border-top: none; transform: translateX(100%);
  }
  .heart-panel--open .heart-panel__sheet { transform: translateX(0); }

  /* AUTH MODAL — centered card instead of bottom sheet */
  .auth-modal-overlay {
    align-items: center;
  }
  .auth-modal-sheet {
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.12);
    max-width: 420px;
    transform: translateY(20px) scale(0.97);
    opacity: 0;
    transition: transform 0.25s cubic-bezier(0.22,1,0.36,1), opacity 0.2s;
  }
  .auth-modal-overlay.open .auth-modal-sheet {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  .auth-modal-knob { display: none; }

  /* DESKTOP LAYOUT — header, sidebar, list grid */
  /* header-row-identity is invisible on desktop — children join .header-top flex row directly */
  .header-row-identity { display: contents; }
  /* Constrain header inner content to match the main layout width */
  header {
    padding-left: max(16px, calc((100vw - 1280px) / 2));
    padding-right: max(16px, calc((100vw - 1280px) / 2));
  }
  /* Single-row header on desktop: add bottom padding since results-bar no longer fills a second row */
  .header-top {
    padding-bottom: 11px;
    flex-wrap: nowrap;
  }
  /* Results bar: fold into the header flex row — no separate second row */
  .results-bar {
    flex: 0 0 auto;
    width: auto;
    margin: 0;
    border-top: none;
    padding: 0;
    background: transparent;
    order: unset;
    align-self: center;
    gap: 6px;
  }
  .results-bar .results-count {
    display: none;
  }
  .results-bar .results-bar-right {
    gap: 6px;
    margin-left: 6px;
  }

  #desktopLayout {
    display: flex;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 16px;
    align-items: flex-start;
    gap: 0;
  }

  #filterSidebar {
    width: 200px;
    flex-shrink: 0;
    position: sticky;
    top: 62px;
    max-height: calc(100vh - 74px);
    overflow-y: auto;
    overflow-x: hidden;
    padding-top: 0;
    padding-bottom: 16px;
    scrollbar-width: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding-right: 8px;
    padding-left: 8px;
    margin-right: 16px;
    margin-top: 6px;
    align-self: flex-start;
    box-shadow: none;
  }
  #filterSidebar::-webkit-scrollbar { display: none; }

  /* Sidebar panels: always open, static, no dropdown chrome */
  #filterSidebar .filter-dropdown { margin-bottom: 4px; }
  #filterSidebar .filter-dropdown-btn { display: none; }
  #filterSidebar .filter-dropdown-panel {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    position: static !important;
    box-shadow: none;
    border: none;
    padding: 0;
    max-width: 100%;
    min-width: 0;
    background: transparent;
  }
  /* Mobility divider, toggle, and items span both columns */
  #filterSidebar .mobility-divider,
  #filterSidebar .mobility-toggle,
  #filterSidebar .mobility-items { grid-column: 1 / -1; }

  /* Sidebar section headers — real HTML elements */
  #filterSidebar .sidebar-section-header {
    display: block;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(180,180,190,0.55);
    font-family: 'Inter', sans-serif;
    padding: 12px 6px 5px;
    grid-column: 1 / -1;
    width: 100%;
  }
  /* Divider line above each section (except Muscle, which is first) */
  #filterSidebar #intentDropdown,
  #filterSidebar #diffDropdown,
  #filterSidebar #equipDropdown {
    border-top: 1px solid var(--border);
    margin-top: 4px;
    padding-top: 4px;
  }

  /* Sidebar items: readable size + brighter text */
  #filterSidebar .dd-item { font-size: 13px; padding: 5px 6px; color: var(--text); }
  #filterSidebar .dd-item:hover { color: var(--accent2); }

  /* Custom checkboxes in sidebar */
  #filterSidebar .dd-item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border: 1.5px solid var(--border2);
    border-radius: 3px;
    background: var(--bg);
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    transition: background 0.12s, border-color 0.12s;
  }
  #filterSidebar .dd-item input[type="checkbox"]:checked {
    background: var(--accent);
    border-color: var(--accent);
  }
  #filterSidebar .dd-item input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 2px;
    top: -1px;
    width: 5px;
    height: 9px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
  }

  /* Chip/tag filter items — desktop sidebar only */
  #filterSidebar .filter-chip {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    font-family: 'Barlow Condensed', sans-serif;
    letter-spacing: 0.04em;
    padding: 3px 9px;
    border-radius: 20px;
    border: 1px solid var(--border2);
    background: transparent;
    color: var(--muted2);
    cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
    white-space: nowrap;
    margin: 0;
    line-height: 1.5;
  }
  #filterSidebar .filter-chip:hover {
    color: var(--text);
    border-color: var(--muted2);
  }
  #filterSidebar .filter-chip.active {
    background: rgba(232,255,71,0.12);
    color: var(--accent);
    border-color: rgba(232,255,71,0.4);
  }

  /* Chip panels: flex-wrap instead of 2-column grid */
  #filterSidebar #musclePanel,
  #filterSidebar #equipPanel,
  #filterSidebar #intentPanel,
  #filterSidebar #diffPanel {
    display: flex !important;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px 0 6px;
  }

  /* Hide filter dropdowns left in results-bar (JS has moved them to sidebar) */
  .results-bar-right .filter-dropdown { display: none; }
  .results-bar-right #clearFiltersBtn { display: none !important; }

  /* Clear button in sidebar: full-width, some bottom spacing */
  #filterSidebar #clearFiltersBtn {
    display: block;
    width: 100%;
    margin-bottom: 10px;
  }

  /* Active filter summary badge at top of sidebar */
  #sidebarFilterBadge {
    padding: 10px 6px 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
  }
  .sfb-count {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted2);
    margin-bottom: 4px;
  }
  .sfb-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 6px;
  }
  .sfb-pill {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.03em;
    padding: 2px 7px;
    border-radius: 20px;
    background: rgba(232,255,71,0.10);
    color: var(--accent);
    border: 1px solid rgba(232,255,71,0.30);
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Single-column card list — video is now inside each card */
  #listContainer {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 6px 0 200px;
  }

  /* Cards: full-width, normal radius */
  #listContainer .ex-card { margin-bottom: 0; display: flex; flex-direction: column; border-radius: 8px; }

  /* Desktop card body: two-column layout — left (meta+diff+actions) + right (video) */
  .ex-card-desktop-body {
    display: grid;
    grid-template-columns: 1fr 240px;
    border-top: 1px solid var(--border);
    min-height: 180px;
  }
  .ex-card-desktop-left {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }
  .ex-card-desktop-right {
    border-left: 1px solid var(--border);
    overflow: hidden;
    position: relative;
    min-height: 180px;
  }
  .ex-card-video-thumb {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
    cursor: pointer;
    background: #111;
  }
  .ex-card-video-thumb .ex-thumb-img--blur {
    position: absolute;
    inset: -10%;
    width: 120%;
    height: 120%;
    object-fit: cover;
    display: block;
    filter: blur(14px) brightness(0.45) saturate(1.2);
    transform: scale(1.05);
    transition: transform 0.3s ease;
  }
  .ex-card-video-thumb .ex-thumb-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: transform 0.3s ease;
  }
  .ex-card-video-thumb:hover .ex-thumb-img { transform: scale(1.03); }
  .ex-card-video-thumb:hover .ex-thumb-img--blur { transform: scale(1.08); }
  .ex-card-video-thumb .ex-thumb-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0);
    transition: background 0.2s;
  }
  .ex-card-video-thumb:hover .ex-thumb-play { background: rgba(0,0,0,0.25); }
  .ex-card-video-thumb .ex-thumb-play-icon {
    width: 36px; height: 36px;
    background: rgba(0,0,0,0.72);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 13px;
    padding-left: 3px;
    opacity: 0;
    transition: opacity 0.2s;
  }
  .ex-card-video-thumb:hover .ex-thumb-play-icon { opacity: 1; }
  .ex-card-video-thumb--no-video {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border: 1.5px solid var(--accent);
    border-radius: 0;
  }
  .ex-card-video-thumb--no-video .ex-thumb-play { position: static; background: none; }
  .ex-card-video-thumb--no-video .ex-thumb-play-icon {
    opacity: 1;
    background: rgba(232,255,71,0.12);
    color: var(--accent);
    width: 44px; height: 44px; font-size: 15px;
  }
  .ex-card-desktop-body .ex-drawer-hero {
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  }
  #listContainer .ex-card .ex-card-main {
    background: linear-gradient(160deg, rgba(36,36,42,0.95) 0%, rgba(20,20,24,0.98) 100%);
  }
  .ex-card-desktop-body .ex-drawer-chips {
    flex: 1;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0;
    padding: 0;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    align-items: center;
  }
  .ex-card-desktop-body .ex-drawer-chip {
    flex: 1 1 0;
    min-width: 0;
    padding: 10px 12px;
    border-right: 1px solid rgba(255,255,255,0.07);
    display: flex;
    flex-direction: column;
    gap: 4px;
    justify-content: center;
    align-self: stretch;
  }
  .ex-card-desktop-body .ex-drawer-chip:last-child { border-right: none; }
  .ex-card-desktop-body .ex-drawer-chip__label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: rgba(180,180,190,0.55); font-family: 'Inter', sans-serif; }
  .ex-card-desktop-body .ex-drawer-chip__val { font-size: 16px; font-weight: 700; color: var(--text); }
  .ex-card-desktop-body .ex-drawer-queue-wrap {
    margin-top: auto; flex-shrink: 0;
    padding: 10px 12px 12px;
    align-items: center;
  }
  .ex-card-desktop-body .ex-drawer-queue-btn {
    padding: 10px;
    font-size: 13px;
    border-radius: 8px;
  }
  .ex-card-desktop-body .ex-drawer-share-btn {
    width: 40px;
    border-radius: 8px;
    align-self: center;
    height: 40px;
  }

  /* Remove forced min-height — content fills the space naturally */
  #listContainer .ex-card .ex-card-main { min-height: unset; align-items: flex-start; padding-top: 14px; }

  /* Load-more sentinel */
  #listContainer #loadMoreSentinel {
    height: 1px;
  }

  /* Inline expand detail panel inside an expanded card */
  .ex-card-inline-detail {
    display: block;
    border-top: 1px solid var(--border);
    padding: 12px 14px 14px;
  }

  /* Side panel stays hidden — inline expand replaces it */
  body.panel-open #listContainer {
    margin-right: 0;
  }

}
