/* Only touch tablets and touch-device landscape; phone portrait stays unchanged. */
@media (orientation:landscape) and (max-width:1400px) and (any-pointer:coarse) {
  html.qb-desktop .qb-app {-webkit-text-size-adjust:100%;text-size-adjust:100%;}
  /* Do not divide a short viewport into two fixed-height rows. Give the image
     a square mount and let the card/list grow and scroll naturally. */
  html.qb-desktop .qb-main .SR_MID>[class^="SR_MID_itemsForSaleContainer"] {
    grid-auto-rows:auto!important; align-items:stretch!important;
  }
  html.qb-desktop .qb-main .SR_MID_itemForSale {
    grid-template-rows:auto 1fr 36px!important; align-content:stretch!important;
    height:auto!important; min-height:0!important; align-self:stretch!important;
    grid-template-columns:30px minmax(0,1fr) 30px!important;gap:6px!important;
  }
  html.qb-desktop .qb-main .SR_MID_itemDescription {font:14px/1.3 Arial,sans-serif!important;align-self:start!important;display:block!important;margin:0!important;padding:0!important;}
  html.qb-desktop .qb-main .SR_MID_itemPrice {font:bold 18px/1.2 Arial,sans-serif!important;}
  html.qb-desktop .qb-main .qb-watch,html.qb-desktop .qb-main .qb-basket {width:30px!important;height:32px!important;padding:3px!important;}
  html.qb-desktop .qb-main .SR_MID_pictureOfStamp {
    aspect-ratio:1/1!important; width:100%!important; height:auto!important;
    min-height:0!important; padding:0!important; box-sizing:border-box!important;
    position:relative!important; align-self:start!important;
  }
  html.qb-desktop .qb-main .SR_MID_pictureOfStamp a {
    position:absolute!important; inset:8px!important;
    display:block!important; width:auto!important; height:auto!important;
    min-height:0!important; margin:0!important; padding:0!important;
  }
  html.qb-desktop .qb-main .SR_MID_pictureOfStamp img {
    width:100%!important; height:100%!important; max-width:100%!important;
    max-height:100%!important; object-fit:contain!important; object-position:center!important; display:block!important;
    position:absolute!important; inset:0!important; margin:0!important; padding:0!important;
  }
  html.qb-desktop .qb-summary {display:grid!important;grid-template-columns:minmax(0,1fr) 170px;align-items:stretch;gap:12px!important;}
  .qbt-summary-info {display:grid;grid-template-columns:repeat(4,minmax(0,1fr));grid-template-rows:repeat(2,auto);gap:10px 16px;align-items:center;min-width:0;}
  html.qb-desktop .qbt-summary-info .qb-total-line {display:flex;flex-direction:column;gap:2px;font-size:14px;min-width:0;}
  .qbt-summary-info .qb-total-line span {font-size:12px;}
  html.qb-desktop .qbt-summary-info .qb-postage {font-size:12px;max-width:none;}
  html.qb-desktop .qbt-summary-info .qb-offers {font-size:13px;}
  html.qb-desktop .qb-summary>.qb-checkout {display:flex;align-items:center;justify-content:center;text-align:center;align-self:stretch;margin:0;font-size:16px;}
}
@media (orientation:portrait) and (min-width:600px) and (max-width:1400px) and (any-pointer:coarse), (orientation:portrait) and (max-width:599px), (orientation:landscape) and (max-width:1000px) and (max-height:500px) {
  html.qbt-compact,html.qbt-compact body {height:auto!important;overflow:visible!important;background:#f3f0e8!important;}
  html.qbt-compact .B_mobile_nav,html.qbt-compact .B_LHS,html.qbt-compact .SR_RHS {display:none!important;}
  html.qbt-compact .SR_wrapper {display:block!important;height:auto!important;overflow:visible!important;}
  .qbt-top,.qbt-top * {box-sizing:border-box;}
  .qbt-top {padding:10px 16px 8px;background:#fbfaf6;color:#203d36;font:15px/1.35 Arial,sans-serif;-webkit-text-size-adjust:100%;text-size-adjust:100%;border-bottom:1px solid #d6dacf;}
  .qbt-top a {color:inherit;}
  .qbt-top h1,.qbt-top p {margin:0;}
  .qbt-nav {display:flex;justify-content:space-between;align-items:center;gap:12px;}
  .qbt-home {font:bold 19px/1.3 Georgia,serif;text-decoration:none;}
  .qbt-nav a,.qbt-top summary {min-height:44px;display:flex;align-items:center;cursor:pointer;}
  .qbt-top summary {gap:6px;}
  .qbt-top summary::before {content:'▸';}
  .qbt-top details[open]>summary::before {content:'▾';}
  .qbt-account {position:relative;}
  .qbt-account-panel {position:absolute;right:0;top:100%;z-index:30;min-width:180px;background:#fbfaf6;border:1px solid #d6dacf;padding:8px;box-shadow:0 6px 20px #183e3420;}
  .qbt-account-panel a,.qbt-account-panel button {display:flex;width:100%;min-height:44px;align-items:center;padding:8px;font:inherit;border:0;background:transparent;color:inherit;text-decoration:none;}
  .qbt-heading {display:flex;align-items:center;justify-content:space-between;gap:16px;margin:4px 0 10px;}
  .qbt-heading h1 {font:26px/1.2 Georgia,serif;}
  .qbt-muted {font-size:13px;color:#607063;margin-top:3px!important;}
  .qbt-checkout {display:flex;align-items:center;justify-content:center;min-height:44px;padding:10px 18px;background:#183e34;color:#fff9e8!important;font-weight:bold;border-radius:5px;text-decoration:none;}
  .qbt-totals {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px 16px;background:#efeee4;border:1px solid #d6dacf;border-radius:5px;padding:10px;}
  .qbt-total {display:flex;flex-direction:column;gap:3px;min-width:0;}
  .qbt-total span {font-size:12px;}
  .qbt-total strong {font-size:17px;}
  .qbt-final strong {color:#183e34;font-size:19px;}
  .qbt-postage {font-size:12px;color:#607063;margin-top:7px!important;}
  .qbt-tools {display:flex;align-items:flex-start;justify-content:space-between;gap:14px;}
  .qbt-tools>details {min-width:0;flex:1;}
  .qbt-portrait-view {display:flex;align-items:center;gap:6px;font:14px/1.3 Arial;}
  .qbt-portrait-view button {min-width:44px;min-height:44px;padding:6px;border:1px solid #899783;border-radius:4px;background:#fbfaf6;color:#203d36;font:16px/1.3 Arial;cursor:pointer;}
  .qbt-portrait-view button.selected {background:#183e34;color:#fff9e8;}
  .qbt-sort {text-align:right;}
  .qbt-sort>summary {justify-content:flex-end;}
  .qbt-offers .B_LHS_para {font:14px/1.4 Arial;color:#203d36;margin:0 0 8px;}
  .qbt-offers .B_LHS_offers_btn {display:inline-flex;width:auto;height:auto;min-height:44px;margin:0!important;padding:8px;border-radius:4px;font:14px/1.4 Arial;background:transparent;color:#203d36;box-shadow:none;}
  .qbt-sort input[type=submit] {position:static;left:auto;width:100%;min-height:44px;margin:0 0 6px;padding:8px;border:1px solid #899783;border-radius:4px;background:#fbfaf6;color:#203d36;font:14px/1.4 Arial;}
  html:root.qbt-compact .SR_MID {position:static!important;width:100%!important;height:auto!important;padding:12px 16px!important;overflow:visible!important;background:transparent!important;}
  html:root.qbt-compact .SR_MID>[class^="SR_MID_itemsForSaleContainer"] {grid-template-columns:repeat(var(--portrait-columns,3),minmax(0,1fr))!important;grid-auto-rows:auto!important;gap:12px!important;padding:0!important;align-items:stretch!important;}
  html:root.qbt-compact .SR_MID_itemForSale {grid-template-rows:auto 1fr 44px!important;align-content:stretch!important;align-self:stretch!important;height:auto!important;min-width:0!important;font:14px/1.35 Arial!important;}
  html:root.qbt-compact .SR_MID_pictureOfStamp {grid-row:1!important;position:relative!important;align-self:start!important;width:100%!important;height:auto!important;aspect-ratio:1/1!important;padding:0!important;box-sizing:border-box!important;}
  html:root.qbt-compact .SR_MID_pictureOfStamp a {position:absolute!important;inset:8px!important;display:block!important;width:auto!important;height:auto!important;}
  html:root.qbt-compact .SR_MID_pictureOfStamp img {position:absolute!important;inset:0!important;width:100%!important;height:100%!important;max-width:100%!important;max-height:100%!important;object-fit:contain!important;object-position:center!important;padding:0!important;margin:0!important;}
  html:root.qbt-compact .SR_MID_itemDescription {grid-row:2!important;align-self:start!important;font:14px/1.35 Arial!important;}
  html:root.qbt-compact .SR_MID_itemForSale>.qbt-action {display:flex!important;align-items:center!important;justify-content:center!important;background-image:none!important;color:#203d36!important;border-radius:4px;padding:6px!important;}
  html:root.qbt-compact .SR_MID_itemForSale>.qbt-basket {background:#d6e6d0!important;border:1px solid #6a8961!important;}
  html:root.qbt-compact [data-portrait-columns="5"] .SR_MID_itemForSale {grid-template-columns:28px minmax(0,1fr) 28px!important;grid-template-rows:auto 1fr 32px!important;gap:4px 2px!important;}
  html:root.qbt-compact [data-portrait-columns="5"] .SR_MID_itemForSale>.qbt-action {grid-row:3!important;width:28px!important;height:30px!important;max-width:28px!important;padding:3px!important;}
  html:root.qbt-compact [data-portrait-columns="5"] .qbt-action svg {width:20px!important;height:20px!important;}
  html:root.qbt-compact [data-portrait-columns="5"] .SR_MID_itemPrice {grid-column:2!important;grid-row:3!important;font:13px/1.35 Arial!important;padding:3px 1px!important;white-space:nowrap;}
  .qbt-action svg {width:28px;height:28px;}
  .qbt-footer {padding:12px 16px;font:12px/1.4 Arial;color:#607063;}
  .qbt-top a:focus-visible,.qbt-top summary:focus-visible,.qbt-top button:focus-visible {outline:3px solid #ad7e26;outline-offset:2px;}
}
/* Phone landscape keeps the same green panels, navigation, and value pills
   as phone portrait. Only the totals use two label/value pairs per row. */
@media (orientation:landscape) and (max-width:1000px) and (max-height:500px) {
  html:root .B_LHS {grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:8px 12px!important;}
  html:root .B_LHS_top_title_1,html:root .B_LHS_top_title_2,html:root .B_LHS_para,html:root .B_LHS_links,html:root .B_LHS .copy2,html:root .add_for_free_postage {grid-column:1/-1!important;}
  html:root .B_LHS_top_title,html:root .B_LHS_info {min-width:0;}
  html:root .SR_MID_pictureOfStamp {position:relative!important;aspect-ratio:1/1!important;height:auto!important;padding:0!important;align-self:start!important;}
  html:root .SR_MID_pictureOfStamp a {position:absolute!important;inset:8px!important;display:block!important;width:auto!important;height:auto!important;padding:0!important;}
  html:root .SR_MID_pictureOfStamp img {position:absolute!important;inset:0!important;width:100%!important;height:100%!important;object-fit:contain!important;object-position:center!important;padding:0!important;margin:0!important;}
}

/* Monitor/laptop basket: shared row alignment independent of title length. */
@media (min-width:1001px) and (orientation:landscape) and (pointer:fine) {
  html.qb-desktop .qb-main .SR_MID>[class^="SR_MID_itemsForSaleContainer"] {grid-auto-rows:auto!important;align-items:stretch!important;}
  html.qb-desktop .qb-main .SR_MID_itemForSale {grid-template-rows:auto 1fr 32px!important;height:auto!important;align-content:stretch!important;align-self:stretch!important;}
  html.qb-desktop .qb-main .SR_MID_itemDescription {align-self:start!important;}
  html.qb-desktop .qb-main .SR_MID_pictureOfStamp {position:relative!important;aspect-ratio:1/1!important;width:100%!important;height:auto!important;align-self:start!important;padding:0!important;}
  html.qb-desktop .qb-main .SR_MID_pictureOfStamp a {position:absolute!important;inset:8px!important;width:auto!important;height:auto!important;display:block!important;}
  html.qb-desktop .qb-main .SR_MID_pictureOfStamp img {position:absolute!important;inset:0!important;width:100%!important;height:100%!important;object-fit:contain!important;object-position:center!important;margin:0!important;padding:0!important;}
}

/* BASKET4 phone layouts share the tablet theme and compact summary. */
@media (orientation:portrait) and (max-width:599px), (orientation:landscape) and (max-width:1000px) and (max-height:500px) {
  html.qbt-phone .qbt-top {padding:8px 12px 4px;}
  html.qbt-phone .qbt-home {font-size:17px;}
  html.qbt-phone .qbt-heading {gap:8px;margin:0 0 8px;}
  html.qbt-phone .qbt-heading h1 {font-size:22px;}
  html.qbt-phone .qbt-totals {gap:8px 10px;padding:8px;}
  html.qbt-phone .qbt-total span {font-size:11px;}
  html.qbt-phone .qbt-total strong {font-size:15px;}
  html.qbt-phone .qbt-final strong {font-size:17px;}
  html.qbt-phone .qbt-postage {font-size:11px;line-height:1.3;margin-top:6px!important;}
  html.qbt-phone .qbt-tools {gap:8px;}
  html.qbt-phone .qbt-tools summary {font-size:14px;}
  html:root.qbt-phone .SR_MID {padding:10px 12px!important;}
  html:root.qbt-phone .SR_MID>[class^="SR_MID_itemsForSaleContainer"] {gap:10px!important;}
  html:root.qbt-phone .SR_MID_itemForSale {grid-template-columns:32px minmax(0,1fr) 32px!important;grid-template-rows:auto 1fr 36px!important;padding:6px!important;gap:5px 2px!important;}
  html:root.qbt-phone .SR_MID_itemDescription {font:13px/1.35 Arial!important;}
  html:root.qbt-phone .SR_MID_itemPrice {font:14px/1.35 Arial!important;padding:3px 1px!important;}
  html:root.qbt-phone .SR_MID_itemForSale>.qbt-action {width:32px!important;height:36px!important;max-width:32px!important;padding:4px!important;}
  html.qbt-phone .qbt-action svg {width:24px;height:24px;}
  html.qbt-phone .qbt-account-panel input[type=search] {width:100%;min-height:44px;font:16px Arial;padding:8px;border:1px solid #899783;border-radius:4px;}
}
@media (orientation:landscape) and (max-width:1000px) and (max-height:500px) {
  html.qbt-phone .qbt-top {display:grid;grid-template-columns:minmax(0,1fr) auto;column-gap:12px;padding:6px 12px 2px;}
  html.qbt-phone .qbt-nav {grid-column:1;grid-row:1;}
  html.qbt-phone .qbt-heading {grid-column:2;grid-row:1;margin:0;}
  html.qbt-phone .qbt-heading h1 {display:none;}
  html.qbt-phone .qbt-heading .qbt-muted {white-space:nowrap;font-size:11px;}
  html.qbt-phone .qbt-totals {grid-column:1/-1;grid-row:2;margin-top:8px;}
  html.qbt-phone .qbt-postage {grid-column:1;grid-row:3;align-self:center;margin-top:0!important;}
  html.qbt-phone .qbt-tools {grid-column:2;grid-row:3;justify-content:flex-end;}
  html.qbt-phone .qbt-sort {position:relative;}
  html.qbt-phone .qbt-sort>div {position:absolute;right:0;top:100%;z-index:30;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;width:300px;max-width:calc(100vw - 24px);padding:8px;background:#fbfaf6;border:1px solid #d6dacf;border-radius:5px;box-shadow:0 6px 20px #183e3420;}
  html.qbt-phone .qbt-sort>div form {min-width:0;margin:0;}
  html.qbt-phone .qbt-sort input[type=submit] {width:100%;min-width:0;margin:0;font-size:13px;padding:8px 4px;}
  html.qbt-phone .qbt-totals {grid-template-columns:repeat(3,minmax(0,1fr));gap:5px 14px;}
  html.qbt-phone .qbt-total {flex-direction:row;align-items:center;justify-content:space-between;gap:8px;}
}

/* Match the light monitor/iPad-landscape sort buttons; override legacy pills. */
html.qbt-compact .qbt-sort input[type=submit] {
  background:#fffefa!important;background-image:none!important;color:#203d36!important;
  border:1px solid #899783!important;border-radius:4px!important;
  box-shadow:none!important;text-shadow:none!important;font-weight:normal!important;
  -webkit-appearance:none;appearance:none;cursor:pointer;
}
html.qbt-compact .qbt-sort input[type=submit]:hover,
html.qbt-compact .qbt-sort input[type=submit]:focus-visible {
  background:#efeee4!important;color:#203d36!important;border-color:#6a8961!important;box-shadow:none!important;
}

/* Portrait sort options use the same framed outer panel as landscape. */
@media (orientation:portrait) and (max-width:1400px) {
  html.qbt-compact .qbt-sort {position:relative;}
  html.qbt-compact .qbt-sort>div {position:absolute;right:0;top:100%;z-index:30;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;width:300px;max-width:calc(100vw - 24px);padding:8px;background:#fbfaf6;border:1px solid #d6dacf;border-radius:5px;box-shadow:0 6px 20px #183e3420;}
  html.qbt-compact .qbt-sort>div form {min-width:0;margin:0;}
  html.qbt-compact .qbt-sort input[type=submit] {width:100%;min-width:0;margin:0;font-size:13px;padding:8px 4px;}
}

/* Laptop compact trial: 1600 x 900 display with browser chrome. */
@media screen and (min-width:1301px) and (max-width:1600px) and (min-height:520px) and (max-height:820px) and (orientation:landscape) and (hover:hover) and (pointer:fine) and (not (any-pointer:coarse)) {
html.qb-desktop .qb-header{padding:6px 18px!important}
html.qb-desktop .qb-brand img{width:46px!important;height:46px!important}
html.qb-desktop .qb-brand span{font-size:17px!important}
html.qb-desktop .qb-main{padding:8px 18px!important}
html.qb-desktop .qb-summary{padding:6px 10px!important;gap:10px!important}
html.qb-desktop .qb-toolbar{padding:6px 0!important}
html.qb-desktop .qb-main .SR_MID_pictureOfStamp{aspect-ratio:1.12!important}
}
