/* V19 readability layer: legible AdPick banners + high-contrast cards across light/dark surfaces. */
:root{
  --v19-ink:#123b47;
  --v19-text:#274f5a;
  --v19-muted:#496a74;
  --v19-link:#00657f;
  --v19-light:#f7fdff;
  --v19-light-muted:#d9f1f7;
}

/* Automatic runtime contrast safety classes. */
.contrast-auto-dark{color:var(--v19-ink)!important}
.contrast-auto-light{color:var(--v19-light)!important}

/* Explicit light-surface protection: never leave pale text on pale cards. */
:where(.archive-card,.quality-card,.card,.editorial-link,.topic-link,.qna-category-tile,.spot-sidebar,.spot-result-item,.rail-card,.wiki-article,.wiki-summary,.wiki-note,.related-grid>a,.external-card,.v17-cluster-links,.v17-cluster-grid>a,.v18-context-card,.v18-context-list>li,.v18-guide-depth,.v17-depth-section,.v17-compare-grid>div,.v17-decision-table>div,.luxe-route>div,.search-panel,.search-item,.affiliate-card,.wiki-infobox td,.wiki-table td){
  color:var(--v19-text)!important;
}
:where(.archive-card,.quality-card,.card,.editorial-link,.topic-link,.qna-category-tile,.spot-sidebar,.spot-result-item,.rail-card,.wiki-article,.wiki-summary,.wiki-note,.related-grid>a,.external-card,.v17-cluster-links,.v17-cluster-grid>a,.v18-context-card,.v18-context-list>li,.v18-guide-depth,.v17-depth-section,.v17-compare-grid>div,.v17-decision-table>div,.luxe-route>div,.search-panel,.search-item,.affiliate-card)
:where(p,li,dd,dt,span,small,em){color:var(--v19-muted)!important}
:where(.archive-card,.quality-card,.card,.editorial-link,.topic-link,.qna-category-tile,.spot-sidebar,.spot-result-item,.rail-card,.wiki-article,.wiki-summary,.wiki-note,.related-grid>a,.external-card,.v17-cluster-links,.v17-cluster-grid>a,.v18-context-card,.v18-context-list>li,.v18-guide-depth,.v17-depth-section,.v17-compare-grid>div,.v17-decision-table>div,.luxe-route>div,.search-panel,.search-item,.affiliate-card)
:where(h1,h2,h3,h4,b,strong){color:var(--v19-ink)!important}

/* Explicit dark-surface protection: never leave dark text on dark cards/sections. */
:where(.topbar,.spot-hero,.spot-hero-card,.knowledge-banner,.site-footer,.premium-footer,.rail-cta,.wiki-navbox-title)
:where(p,li,dd,dt,span,small,em,a,h1,h2,h3,h4,b,strong){color:var(--v19-light)!important}
:where(.topbar,.spot-hero,.spot-hero-card,.knowledge-banner,.site-footer,.premium-footer,.rail-cta)
:where(p,small,span,li){color:var(--v19-light-muted)!important}

/* Keep intentionally colored controls readable. */
.btn.primary,.archive-tabs button.active,.filter-bar button.active,.qna-filter-row button.active,.zone-tabs button.active,.home-search button{color:#fff!important}
.btn.secondary,.btn:not(.primary){color:#075d78!important}

/* AdPick: compact like a display ad, but product names remain actually readable. */
.affiliate-recommendations,.affiliate-placement-top,.affiliate-placement-bottom{
  padding:3px 0!important;margin:0!important;min-height:0!important;
  background:#fbfdfe!important;border-color:#d9e7eb!important;
}
.affiliate-shell{width:min(100% - 24px,920px)!important;max-width:920px!important;margin:0 auto!important}
.affiliate-head,.affiliate-disclosure{display:none!important}
.affiliate-grid{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:6px!important;margin:0!important;padding:0!important;overflow:visible!important}
.affiliate-card{
  display:grid!important;grid-template-columns:58px minmax(0,1fr)!important;
  width:100%!important;height:66px!important;min-height:66px!important;max-height:66px!important;
  overflow:hidden!important;border:1px solid #cfdee3!important;border-radius:8px!important;
  background:#fff!important;box-shadow:none!important;text-decoration:none!important;
}
.affiliate-card:hover{border-color:#7fb9c8!important;background:#fff!important;box-shadow:0 2px 8px rgba(7,75,95,.07)!important}
.affiliate-visual{display:block!important;width:58px!important;height:64px!important;min-width:58px!important;overflow:hidden!important;background:#fff!important}
.affiliate-visual img{display:block!important;width:100%!important;height:100%!important;object-fit:contain!important;background:#fff!important}
.affiliate-body{
  display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;
  grid-template-rows:12px minmax(28px,1fr) 14px!important;column-gap:7px!important;
  width:100%!important;height:64px!important;min-height:0!important;padding:5px 8px!important;overflow:hidden!important;
}
.affiliate-mall{grid-column:1/3!important;display:block!important;color:#526f79!important;font-size:8.5px!important;line-height:1.05!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important}
.affiliate-body h3{
  grid-column:1/3!important;display:-webkit-box!important;margin:1px 0!important;
  color:#123b47!important;font-size:11.5px!important;line-height:1.22!important;font-weight:800!important;
  white-space:normal!important;overflow:hidden!important;text-overflow:clip!important;
  -webkit-box-orient:vertical!important;-webkit-line-clamp:2!important;
}
.affiliate-price{grid-column:1!important;display:flex!important;align-items:end!important;margin:0!important;padding:0!important;min-width:0!important}
.affiliate-price strong{color:#005f78!important;font-size:11px!important;line-height:1!important;font-weight:900!important;white-space:nowrap!important}
.affiliate-price del{display:none!important}
.affiliate-cta{grid-column:2!important;align-self:end!important;margin:0!important;padding:0!important;border:0!important;color:#00657f!important;font-size:8.5px!important;line-height:1!important;font-weight:800!important;white-space:nowrap!important}

/* Viewport safety: no ordinary content should require horizontal dragging. */
html,body{max-width:100%!important;overflow-x:hidden!important}
main,section,article,aside,header,footer,.container{max-width:100%}
img,svg,video,canvas,iframe{max-width:100%!important}
:where(p,li,dd,dt,th,td,a,button,label,span,strong,b,small,h1,h2,h3,h4,summary){overflow-wrap:anywhere;word-break:keep-all}

@media(max-width:720px){
  .affiliate-shell{width:calc(100% - 12px)!important;max-width:100%!important}
  .affiliate-grid{grid-template-columns:minmax(0,1fr)!important;gap:0!important}
  .affiliate-card{grid-template-columns:54px minmax(0,1fr)!important;height:62px!important;min-height:62px!important;max-height:62px!important}
  .affiliate-card:nth-child(n+2){display:none!important}
  .affiliate-visual{width:54px!important;height:60px!important;min-width:54px!important}
  .affiliate-body{height:60px!important;grid-template-rows:10px minmax(27px,1fr) 13px!important;padding:4px 7px!important;column-gap:5px!important}
  .affiliate-mall{font-size:8px!important}
  .affiliate-body h3{font-size:11px!important;line-height:1.2!important;-webkit-line-clamp:2!important}
  .affiliate-price strong{font-size:10.5px!important}
  .affiliate-cta{display:none!important}
}
@media(max-width:380px){
  .affiliate-card{grid-template-columns:50px minmax(0,1fr)!important;height:60px!important;min-height:60px!important;max-height:60px!important}
  .affiliate-visual{width:50px!important;height:58px!important;min-width:50px!important}
  .affiliate-body{height:58px!important;padding:4px 6px!important}
  .affiliate-body h3{font-size:10.5px!important}
  .affiliate-price strong{font-size:10px!important}
}
