/* Independent phone layout for the member library; loaded after the desktop styles. */
@media (max-width: 900px) {
  :root { --tb-nav-h: 108px; --tb-slot-h: 100px; --tb-pad: 16px; }
  :root body .tb-nav { height: auto !important; }
  :root body .tb-nav-content { display: grid !important; grid-template-columns: 44px minmax(44px,1fr) auto !important; grid-template-rows: 44px 44px !important; gap: 4px 8px !important; height: auto !important; padding: 8px 16px !important; }
  :root body .tb-nav-content > [data-part=navLeft] { display: contents !important; }
  :root body .tb-nav-content .tb-logo { grid-column: 1; grid-row: 1; width: 44px !important; height: 44px !important; display: flex !important; align-items: center; justify-content: center; }
  :root body .tb-nav-content .tb-tabs { grid-column: 1 / -1; grid-row: 2; min-width: 0; height: 44px !important; width: 100% !important; gap: 20px !important; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; }
  :root body .tb-nav-content .tb-tabs a { display: inline-flex !important; align-items: center; flex: none !important; min-height: 44px; font-size: 14px !important; white-space: nowrap; }
  :root body .tb-nav-content > [data-part=searchWrap] { grid-column: 2 !important; grid-row: 1 !important; min-width: 0; }
  :root body .tb-nav-content .tb-search-button { width: 100% !important; height: 44px !important; min-height: 44px; padding: 0 12px !important; gap: 8px !important; justify-content: center !important; }
  :root body .tb-nav-content .tb-search-text, :root body .tb-nav-content [data-part=searchShortcut] { display: none !important; }
  :root body .tb-nav-content > [data-part=navRight] { grid-column: 3 !important; grid-row: 1 !important; gap: 0 !important; }
  :root body .tb-nav-right { gap: 0 !important; }
  :root body .tb-nav-right > :is(.view-switch,.tb-bell,.saved-entry,.account-entry) { display: inline-flex !important; align-items: center; justify-content: center; width: 44px !important; height: 44px !important; min-height: 44px !important; padding: 10px !important; }
  :root body .tb-nav-content:has(.tb-plan-badge:not([hidden])) { grid-template-rows: 44px 44px 44px !important; }
  :root body .tb-nav-content:has(.tb-plan-badge:not([hidden])) > [data-part=navRight] { grid-column: 1 / -1 !important; grid-row: 3 !important; justify-content: flex-end; }
  :root body .tb-slot { height: auto !important; min-height: 100px; }
  :root body .tb-slot-content, :root body .tb-slot[data-search-compact=true] .tb-slot-content { display: grid !important; grid-template-columns: minmax(0,1fr) auto !important; grid-template-rows: auto auto; gap: 4px 12px !important; height: auto !important; padding: 4px 16px 8px !important; }
  :root body .tb-slot-left { grid-column: 1 / -1; grid-row: 1; width: 100%; max-width: 100%; min-width: 0; margin: 0 !important; padding: 0 0 4px !important; overflow-x: auto; overscroll-behavior-x: contain; mask-image: none !important; -webkit-mask-image: none !important; }
  :root body .tb-slot-left [data-part=pillRow] { width: max-content; }
  :root body .tb-slot-left button { min-height: 44px; }
  :root body .tb-slot-right, :root body .tb-slot[data-search-compact=true] .tb-slot-right { grid-column: 2 !important; grid-row: 2; min-height: 44px; gap: 8px !important; }
  :root body .tb-slot-search { grid-column: 1; grid-row: 2; min-width: 0; }
  :root body .tb-slot-right button { min-height: 44px; }
  :root body .tb-filter-panel, :root body .tb-palette { inset: 0 !important; box-sizing: border-box; width: 100% !important; max-width: 100% !important; height: 100dvh !important; max-height: 100dvh !important; margin: 0 !important; border-radius: 0; }
  :root body .tb-fp-head { position: relative; display: block; padding: max(16px,env(safe-area-inset-top)) 16px 12px; }
  :root body .tb-fp-head h2 { padding-right: 52px; font-size: 18px; line-height: 1.5; }
  :root body .tb-fp-tools { flex-wrap: wrap; gap: 8px; margin-top: 12px; padding-right: 0; }
  :root body .tb-fp-close { position: absolute; top: max(12px,env(safe-area-inset-top)); right: 12px; width: 44px; height: 44px; }
  :root body .tb-fp-order { max-width: 100%; height: auto; flex-wrap: wrap; border-radius: 16px; }
  :root body .tb-fp-order button, :root body .tb-fp-reset { min-height: 44px; height: auto; font-size: 13px; }
  :root body .tb-fp-body { display: block; min-height: 0; overflow: hidden; }
  :root body .tb-fp-groups { box-sizing: border-box; height: 100%; padding: 12px 16px max(32px,env(safe-area-inset-bottom)); overscroll-behavior: contain; }
  :root body .tb-fp-group ul { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 4px 12px; }
  :root body .tb-fp-group li { min-width: 0; }
  :root body .tb-fp-group a, :root body .tb-fp-group button { width: 100%; min-height: 44px; font-size: 16px; line-height: 1.5; flex-wrap: wrap; gap: 4px 8px; }
  :root body .tb-fp-group small { font-size: 12px; }
  :root body .tb-menu { max-width: calc(100vw - 32px) !important; max-height: calc(100dvh - 32px); }
  :root body .tb-menu [data-part=menuScroll] { max-height: min(433px,60dvh) !important; }
  :root body .tb-menu [data-value], :root body .tb-sortmenu button, :root body .tb-account-row { min-height: 44px; }
  :root body .tb-palette input, :root body .tb-menu input, :root body input[type=search], :root body select { font-size: 16px !important; }
  :root body .tb-palette [data-part=paletteMain], :root body .tb-palette [data-part=paletteScroll] { min-height: 0; }
  body.no-sidebar main#content { padding-inline: 16px !important; padding-bottom: max(80px,env(safe-area-inset-bottom)) !important; }
  body.no-sidebar #content .gallery-grid { --cell-min: 0px; grid-template-columns: minmax(0,1fr) !important; }
  .site-card .save-button, .site-card .bookmark-button { min-width: 44px; min-height: 44px; }
}
@media (max-width: 359px) {
  :root body .tb-nav-content { padding-inline: 12px !important; gap: 4px !important; }
  :root body .tb-nav-content .tb-tabs { gap: 16px !important; }
  :root body .tb-fp-group ul { grid-template-columns: minmax(0,1fr); }
}

@media (max-width:900px) {
  :root:has(.tb-nav) { --tb-nav-h:108px !important; --tb-slot-h:108px !important; }
  :root:has(.tb-nav .tb-plan-badge:not([hidden])) { --tb-nav-h:156px !important; }
  :root body .tb-nav-content:has(.tb-plan-badge:not([hidden])) .tb-search-button { justify-content:flex-start !important; }
  :root body .tb-nav-content:has(.tb-plan-badge:not([hidden])) .tb-search-text { display:block !important; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; min-width:0; font-size:14px !important; }
}

.tb-palette-close { display:none; }
@media (max-width:900px) {
  :root body .tb-palette [data-part=paletteGrid] { box-sizing:border-box; width:100% !important; height:100dvh !important; max-height:100dvh !important; border-radius:0 !important; }
  :root body .tb-palette [data-part=paletteHead] { display:grid !important; grid-template-columns:minmax(0,1fr) auto 44px; gap:8px; height:auto !important; min-height:64px; padding:12px 16px !important; }
  :root body .tb-palette [data-part=paletteInputWrap] { padding:0 !important; min-width:0; }
  :root body .tb-palette [data-part=paletteInput] { min-height:44px; }
  :root body .tb-palette [data-part=paletteBody] { min-height:0 !important; flex:1 !important; }
  :root body .tb-palette [data-part=paletteMain] { min-height:0 !important; flex:1 !important; }
  :root body .tb-palette-close { display:grid;place-items:center; width:44px;height:44px;border:0;border-radius:50%;background:rgb(128 128 128 / .12);color:inherit;cursor:pointer; }
  .tb-palette-close svg { width:20px;height:20px; }
  .tb-palette-close:focus-visible { outline:2px solid currentColor;outline-offset:3px; }
}

@media (min-width:600px) and (max-width:900px) {
  :root:has(.tb-nav), :root:has(.tb-nav .tb-plan-badge:not([hidden])) { --tb-nav-h:108px !important; }
  :root body .tb-nav-content:has(.tb-plan-badge:not([hidden])) { grid-template-rows:44px 44px !important; }
  :root body .tb-nav-content:has(.tb-plan-badge:not([hidden])) > [data-part=navRight] { grid-column:3 !important;grid-row:1 !important; }
  :root body .tb-nav-content .tb-search-text { display:block !important;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;font-size:14px !important; }
  :root body .tb-nav-content .tb-search-button { justify-content:flex-start !important; }
  body.no-sidebar #content .gallery-grid { grid-template-columns:repeat(2,minmax(0,1fr)) !important; }
}

@media(max-width:900px){
 :root body .m-saved,:root body .m-saved>header,:root body .m-saved-bar{min-width:0!important;width:100%;max-width:100%;box-sizing:border-box}
 :root body .m-saved>header{flex-wrap:wrap!important}
 :root body .m-saved>header h1{min-width:0;flex:1 1 100%}
 :root body .m-saved .m-saved-seg{min-width:0!important;max-width:100%;flex:0 1 auto!important;overflow-x:auto}
 :root body .m-saved .m-saved-seg button{min-height:44px}
 :root body .m-saved .m-saved-find{min-width:0!important;flex:1 1 100%!important}
}

/* Compact list toolbar: filters scroll within their track; actions stay on the same row. */
:root:has(.tb-slot [data-part=pillRow]) { --tb-slot-h:48px !important; }
:root body .tb-slot:has([data-part=pillRow]) { height:48px !important; min-height:48px; }
/* The old sticky background extension covered another nav-height below this row. */
:root body .tb-slot:has([data-part=pillRow])::after { content:none; }
:root body .tb-slot:has([data-part=pillRow]) .tb-slot-content {
  display:flex !important; flex-wrap:nowrap !important; gap:10px !important;
  height:100% !important; padding:4px var(--tb-pad) !important;
}
:root body .tb-slot:has([data-part=pillRow]) .tb-slot-left {
  flex:1 1 0 !important; min-width:0; width:auto; max-width:none;
  margin:0 !important; padding:2px 0 !important; overflow-x:auto;
}
:root body .tb-slot [data-part=pillRow] { width:max-content; gap:6px !important; }
:root body .tb-slot [data-part=pillRow] button {
  height:32px !important; min-height:32px; font-size:13px !important; line-height:18px !important;
}
:root body .tb-slot [data-part=pillRow] :is([data-part=pill],[data-part=pillOn]):not(.tb-picked-open) { padding-inline:10px !important; }
:root body .tb-slot [data-part=pillChevronBox],
:root body .tb-slot [data-part=pillRow] svg { width:16px !important; height:16px !important; }
:root body .tb-slot:has([data-part=pillRow]) .tb-slot-right {
  display:flex !important; flex:0 0 auto !important; min-height:32px; gap:8px !important;
}
:root body .tb-slot:has([data-part=pillRow]) .tb-slot-right button {
  height:32px !important; min-height:32px; font-size:13px !important;
}
:root body .tb-slot:has([data-part=pillRow]) [data-part=filterLabel] { font-size:13px !important; }
:root body .tb-slot:has([data-part=pillRow]) [data-part=filterButton] { padding-inline:4px !important; }
:root body .tb-slot:has([data-part=pillRow]) [data-part=filterInner] { gap:4px !important; }
:root body .tb-slot:has([data-part=pillRow]) .tb-count { flex-direction:row; gap:4px; font-size:11px; line-height:16px; margin:0; }
:root body .tb-slot:has([data-part=pillRow]) .tb-count-n { white-space:nowrap; }
:root body .tb-slot:has([data-part=pillRow]) .tb-rule { height:18px; }
:root body .tb-slot:has([data-part=pillRow]) .tb-slot-search { flex:0 0 32px; width:32px; min-width:0; }
:root body .tb-slot:has([data-part=pillRow]) .tb-slot-search .tb-search-button { width:32px !important; height:32px !important; padding:0 !important; justify-content:center !important; }
:root body .tb-slot:has([data-part=pillRow]) .tb-slot-search .tb-search-text { display:none !important; }
@media(max-width:1100px) {
  :root body .tb-slot:has([data-part=pillRow]) .tb-count > span:first-child { display:none; }
}
@media(max-width:600px) {
  :root body .tb-slot:has([data-part=pillRow]) .tb-slot-content { gap:6px !important; }
}
@media(pointer:coarse) {
  :root:has(.tb-slot [data-part=pillRow]) { --tb-slot-h:52px !important; }
  :root body .tb-slot:has([data-part=pillRow]) { height:52px !important; }
  :root body .tb-slot:has([data-part=pillRow]) button { min-height:44px; }
}
