.kw{color:#13244d}.kw h1{font-size:28px}.kw header{margin-bottom:10px}.kw .primary{background:#075bfa;border-color:#075bfa}
.kwToolbar{gap:14px;padding:10px 12px;background:#fbfcff}.kwToolbar label{display:flex;gap:7px;align-items:center}.kwToolbar select{min-width:115px;padding:8px}.kwToolbar #definitions{margin-left:auto}
.kwBack{display:none}.kwLayout{display:grid;grid-template-columns:minmax(0,2fr) minmax(0,3fr);gap:12px;align-items:start}
.kw .panel{border-color:#dce6fb;box-shadow:0 2px 5px #27488409;padding:13px;background:#fcfdff}
.kw .panel h2{font-size:19px;margin-bottom:12px}.kwRight{min-width:0}.segments{display:flex;flex-wrap:wrap;gap:3px}.segments button{background:#f5f8ff;padding:7px 10px;font-weight:600}
.segments button[aria-pressed=true]{background:#1767ff;color:white;border-color:#1767ff}.kwBoard #search{width:100%;margin:12px 0 8px;min-width:0}.kwFilters{display:flex;gap:8px;margin-bottom:10px}.kwFilters select{min-width:0;flex:1;padding:7px}
.kwBoardScroll{max-height:520px;overflow:auto;overscroll-behavior:contain}.kw table{table-layout:fixed;border-collapse:collapse;width:100%}.kw td,.kw th{padding:8px 4px;overflow-wrap:anywhere}
.kw th{background:#ebf1ff;color:#263b64;font-size:11px}.kwBoard th{position:sticky;top:0}.kwBoard th:first-child{width:10%}.kwBoard th:nth-child(2){width:23%}.kwBoard th:nth-child(3){width:23%}.kwBoard tr[data-index]{cursor:pointer}.kwBoard tr[data-index]:hover,.kwBoard .chosen{background:#e1edff}
.kwWord{font-weight:700;background:none;border:0;padding:0;text-align:left;overflow-wrap:anywhere}.kwBadge{display:inline-block;border-radius:5px;padding:3px 5px;background:#edf1f8;color:#465674;font-weight:650}.kwBadge.good,.kwAssessment.good{color:#14713b;background:#e7f8ed}.kwBadge.bad,.kwAssessment.bad{color:#a92342;background:#fcebf0}.kwBadge.entry,.kwAssessment.entry{color:#4c36ab;background:#eeeaff}.kwDelta{display:block;color:#506282;margin-top:2px}
.kwPager{display:flex;gap:6px;align-items:center;justify-content:flex-end;margin-top:9px}.kwPager span{margin-right:auto}.kwPager button{padding:4px 9px}.kwPager b{color:#075bfa}
.kwHeading{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap;margin-bottom:9px}.kw #detailHeading h2{margin:0;overflow-wrap:anywhere}.kwHeading small{font-size:12px;color:#586c96}.kwHeading select{padding:5px}
.kwAssessment{display:flex;align-items:center;gap:14px;padding:10px;border-radius:8px;background:#edf3ff;margin-bottom:9px}.kwAssessment strong{font-size:17px;flex:none}.kwAssessment span{line-height:1.6}
#keywordMetrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:7px;margin-bottom:10px}.kwMetric{border:1px solid #dce6fa;background:#fff;border-radius:8px;padding:8px;min-width:0}.kwMetric b{display:block;color:#123d9a;font-size:19px;margin:4px 0;overflow-wrap:anywhere}.kwMetric small{color:#54698e}.kwMetric i{font-style:normal;color:#1767ff;margin-right:5px}
.kwChartRow{display:grid;grid-template-columns:minmax(0,1.6fr) minmax(0,1fr);gap:8px;margin-top:5px}.kwChartRow>*{border:1px solid #e0e8fa;border-radius:8px;min-width:0}.kwBasis{padding:10px;background:#f7faff}.kwBasis summary{cursor:pointer;font-weight:700}.kwBasis ul{list-style:none;padding:0;margin:8px 0 0}.kwBasis li{padding:5px 0;line-height:1.5}.kwBasis li::before{content:'• ';color:#1767ff}#keywordChart{height:205px;background:white}
.kwProducts p,.kwEmpty{margin:0;padding:15px;background:#f2f6fc;border-radius:7px;color:#53698e;line-height:1.6}.kwNav a{display:block}.kwNav .active{background:#075bfa}#uploadForm label{display:block;margin:12px 0}#credentials{margin-bottom:10px}
@media(max-width:1120px){.kwChartRow{grid-template-columns:1fr}#keywordMetrics{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:820px){.kwLayout{grid-template-columns:minmax(0,1fr)}.kwBoardScroll{max-height:310px}}
@media(max-width:600px){.kwBack{display:block}.kw h1{font-size:20px}.kw header p{font-size:11px}.kwToolbar #definitions{margin-left:0}.kwAssessment{align-items:flex-start;flex-direction:column;gap:4px}}

.kwBoard .chosen td:first-child{box-shadow:inset 3px 0 #1767ff}.kwChartRow{grid-template-columns:minmax(0,1.6fr) minmax(0,1fr)}
@media(max-width:1120px){.kwChartRow{grid-template-columns:minmax(0,1fr)}}
#boardPager{justify-content:flex-start;color:#53698e}
 .kwProductGrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,115px),1fr));gap:8px;margin-top:10px}
.kwProductTile{position:relative;min-width:0}
.kwProductPhoto,.kwProductLarge{position:relative;display:grid;place-items:center;border-radius:6px;overflow:hidden;background:#edf2fc;color:#53698e}
.kwProductPhoto{width:100%;aspect-ratio:1;padding:0}
.kwProductPhoto img,.kwProductLarge img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.kwProductPhoto img[hidden],.kwProductLarge img[hidden]{display:none}
.kwProductPhoto strong{position:absolute;top:5px;left:5px;background:#075bfa;color:white;border-radius:4px;padding:2px 5px}
.kwProductPreview{position:absolute;z-index:5;top:calc(100% - 3px);left:0;width:min(300px,calc(100vw - 24px));padding:9px;border:1px solid #d4def0;border-radius:8px;background:white;box-shadow:0 8px 28px #172b5129;line-height:1.6;overflow-wrap:anywhere}
.kwProductPreview.above{top:auto;bottom:calc(100% - 3px)}
.kwProductLarge{height:min(265px,38vh)}
.kwProductLarge img{object-fit:contain;background:#f5f7fa}
.kwProductTitle{margin:6px 0;color:#1259d9;font-weight:700}
.kwProductTitle a:hover,.kwProductTitle a:focus-visible{text-decoration:underline}

@media(min-width:821px){
  .kwLayout{align-items:stretch}
  .kwBoard{display:flex;flex-direction:column;min-height:0}
  .kwBoardScroll{flex:1;min-height:220px;max-height:none;contain:size}
}
@media(min-width:821px){
  .kwBoard > :not(.kwBoardScroll),.kwBoard #search{flex:none}
}
/* Keep keyword selection independent of the number of matched products. */
.kwRight{display:grid;grid-template-rows:470px 360px;gap:14px}
.kwRight>.panel{height:100%;margin:0;box-sizing:border-box}
#analysis[hidden]{display:block;visibility:hidden}
#analysis{display:flex;flex-direction:column;min-height:0}
#analysis[hidden]{display:flex}
.kwHeading{min-height:32px}
.kwAssessment{min-height:68px;box-sizing:border-box}
.kwChartRow{flex:1;min-height:0}
#keywordChart{height:100%;min-height:160px}
.kwBasis{overflow:auto}
.kwProducts{min-height:0}
.kwProductGrid{grid-template-columns:repeat(6,minmax(0,1fr))}
.kwProductPhoto{aspect-ratio:auto;height:115px}
@media(min-width:821px){
  .kwBoard{height:844px;box-sizing:border-box}
  .kwBoardScroll{min-height:0}
}
@media(min-width:821px) and (max-width:1120px){
  .kwRight{grid-template-rows:650px 390px}
  .kwBoard{height:1054px}
  .kwProductGrid{grid-template-columns:repeat(4,minmax(0,1fr))}
  .kwProductPhoto{height:85px}
  .kwChartRow{grid-template-rows:210px minmax(0,1fr)}
}
@media(max-width:820px){
  .kwRight{grid-template-rows:700px 560px}
  .kwChartRow{grid-template-columns:minmax(0,1fr);grid-template-rows:210px minmax(0,1fr)}
  .kwProductGrid{grid-template-columns:repeat(3,minmax(0,1fr))}
  .kwProductPhoto{height:95px}
}
/* Preserve the full source image inside each stable thumbnail slot. */
.kwProductPhoto img{object-fit:contain;background:#f5f7fa}
/* Square product slots with a stable two-row reserve at each breakpoint. */
.kwProductPhoto{height:auto;aspect-ratio:1}
.kwRight{grid-template-rows:470px auto}
.kwProducts{min-height:calc((100vw - 233px)*.2 + 118px)}
@media(min-width:821px){
  .kwBoard{height:auto}
  .kwProducts{height:auto!important}
}
@media(min-width:821px) and (max-width:1120px){
  .kwRight{grid-template-rows:650px auto}
  .kwProducts{min-height:calc((100vw - 113px)*.45 + 125px)}
}
@media(max-width:820px){
  .kwRight{grid-template-rows:700px auto}
  .kwProducts{min-height:calc((100vw - 100px)*1.334 + 140px)}
}
@media(min-width:821px){.kwBoard{margin-bottom:0}}
