/* DriftFix v86 PRE-CODEX builder polish
   Safe, presentation-only overrides. Do not remove the existing geometry stylesheet;
   Codex should merge these rules into the final shared builder shell after verification. */

:root{
  --df-preview-bg:#0b1216;
  --df-preview-bg-2:#10191f;
  --df-preview-line:#293b45;
}

/* Remove the stark white slab around controller/reference imagery. */
.geometryPhoto,
.geometryFocus > .geometryCard,
.geometryStrictPrimary .previewPanel .art,
.geometryStrictPrimary .stage,
.geometryStrictPrimary .previewPanel{
  background:
    radial-gradient(circle at 50% 43%,rgba(77,131,151,.12),transparent 42%),
    linear-gradient(155deg,var(--df-preview-bg-2),var(--df-preview-bg)) !important;
}
.geometryPhoto img,.geometryPhoto canvas,.geometryFittedPhoto,
.geometryStrictPrimary .previewPanel .art img,
.geometryStrictPrimary .previewPanel .art canvas{
  filter:drop-shadow(0 20px 24px rgba(0,0,0,.42));
}
.geometryQuickPicker img{background:#111b20 !important}

/* Fallback/listing references should be useful, not a tiny thumbnail in a huge panel. */
.geometryCard.unavailable .geometryPhoto,
.geometryCard.unavailable .geometryFallback,
.geometryCard.unavailable{
  min-height:clamp(360px,58vh,690px);
}
.geometryCard.unavailable .geometryListingPhoto,
.geometryFocus .geometryCard.unavailable .geometryListingPhoto{
  display:block;
  width:min(82%,760px) !important;
  max-width:760px !important;
  height:auto !important;
  max-height:62vh !important;
  object-fit:contain !important;
  margin:18px auto !important;
  padding:0 !important;
  background:transparent !important;
  border-radius:12px;
  filter:drop-shadow(0 18px 28px rgba(0,0,0,.36));
}
.geometryCard.unavailable>p{max-width:760px;margin:8px auto 16px !important;text-align:center;color:#c9d4da}

/* Edge/Elite: copy the visual proportions of the three-column primary builders as closely
   as possible without rewriting their shared model-builder runtime in this overlay. */
@media(min-width:1200px){
  .geometryStrictPrimary .builderWorkspace,
  body:has(.builderWorkspace) .builderWorkspace{
    grid-template-columns:minmax(180px,.7fr) minmax(0,1.65fr) minmax(260px,1fr) !important;
    gap:14px !important;
    align-items:stretch !important;
  }
  body:has(.builderWorkspace) .builderMenu,
  body:has(.builderWorkspace) .controls,
  body:has(.builderWorkspace) .previewPanel{
    min-width:0;
    height:calc(100vh - 94px);
    max-height:900px;
    overflow:hidden;
  }
  body:has(.builderWorkspace) .builderMenu,
  body:has(.builderWorkspace) .controls{overflow:auto}
  body:has(.builderWorkspace) .previewPanel{
    display:grid !important;
    grid-template-rows:auto minmax(0,1fr) auto auto !important;
    padding:14px !important;
  }
  body:has(.builderWorkspace) .previewPanel .art{
    min-height:0 !important;
    height:100% !important;
    place-items:center !important;
    overflow:hidden !important;
    border:1px solid var(--df-preview-line);
    border-radius:14px;
  }
  body:has(.builderWorkspace) .previewPanel .art img,
  body:has(.builderWorkspace) .previewPanel .art canvas,
  body:has(.builderWorkspace) .previewPanel .geometryPhoto{
    width:100% !important;
    height:100% !important;
    max-width:100% !important;
    max-height:100% !important;
    object-fit:contain !important;
  }
  body:has(.builderWorkspace) .previewPanel .priceBox{
    grid-template-columns:repeat(4,minmax(0,1fr)) !important;
  }
}

/* Reset must remain visible beside the main action. */
.resetBuildV86{
  width:100%;
  margin-top:7px !important;
  min-height:40px;
  border:1px solid #455a64;
  border-radius:10px;
  background:#10191f;
  color:#e7eef1;
  font-weight:900;
  cursor:pointer;
}
.resetBuildV86:hover{border-color:#7ea0af;background:#152129}

/* ROG accessory browse cards share the builder visual language. */
.allyAccessories .accessoryCard{transition:border-color .15s ease,transform .15s ease}
.allyAccessories .accessoryCard:hover{transform:translateY(-1px)}

@media(max-width:900px){
  .geometryCard.unavailable .geometryPhoto,
  .geometryCard.unavailable .geometryFallback,
  .geometryCard.unavailable{min-height:300px}
  .geometryCard.unavailable .geometryListingPhoto,
  .geometryFocus .geometryCard.unavailable .geometryListingPhoto{width:min(92%,620px)!important;max-height:52vh!important}
}

/* v87: prevent min-column overflow and preserve essential preview warnings. */
:root{--df-rail-size:minmax(180px,.7fr);--df-model-size:minmax(0,1.65fr);--df-parts-size:minmax(260px,1fr)}
.layout,.builderWorkspace,.panel,.geometryFocus,.geometryCard,.geometryPhoto{min-width:0}
@media(min-width:1200px){
 body.geometryStrictPrimary .layout:has(>.stage),
 body.geometryStrictPrimary .builderWorkspace{
  display:grid;grid-template-columns:var(--df-rail-size) var(--df-model-size) var(--df-parts-size)!important;gap:14px!important;
 }
 .geometryStrictPrimary .previewPanel .priceBox .resetBuildV86{grid-column:1/-1}
}
@media(max-width:1199px){
 body .builderWorkspace{display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:12px!important;width:100%;max-width:100%}
 body .builderWorkspace>.builderMenu,body .builderWorkspace>.controls,body .builderWorkspace>.previewPanel{height:auto!important;max-height:none!important;position:static!important;min-width:0;overflow:visible}
 body .builderWorkspace>.controls{grid-column:1/-1!important}
 .builderWorkspace .builderCategoryNav{display:flex;overflow-x:auto;max-width:100%;gap:6px}
 .builderWorkspace .builderCategoryNav>button{flex:0 0 auto;max-width:210px}
 .builderWorkspace .previewPanel .priceBox{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))!important}
 .builderWorkspace .previewPanel .priceBox>.primary,.builderWorkspace .previewPanel .priceBox>.resetBuildV86,.builderWorkspace .previewPanel .priceBox>.status{grid-column:1/-1}
}
.geometryStrictPrimary .previewPanel:has(>.geometryFocus)>.art{display:none!important}
.geometryFocus>.geometryCard.unavailable{min-height:0!important;display:flex;flex-direction:column;overflow:auto}
.geometryFocus>.geometryCard.unavailable .geometryPhoto,.geometryFocus>.geometryCard.unavailable .geometryFallback{min-height:180px!important;max-height:none;flex:1 1 auto;overflow:hidden}
.geometryFocus>.geometryCard.unavailable .geometryListingPhoto{display:block;width:92%!important;height:auto!important;max-width:100%!important;max-height:100%!important;margin:8px auto!important;object-fit:contain!important}
.geometryFocus>.geometryCard .geometryKind,.geometryFocus>.geometryCard .geometryViewNote{display:block!important;flex:0 0 auto;margin:0;padding:5px 10px;font-size:11px;line-height:1.35;color:#cfdee7;background:#152129;overflow-wrap:anywhere}
.geometryFocus>.geometryCard .geometryPartHeading{display:none!important}
.geometryCard.unavailable>p{padding:6px 10px;margin:0!important;flex:0 0 auto;line-height:1.4}
.builderWorkspace .sumRow,.builderWorkspace .sectionTitle,.geometryQuickNav{overflow-wrap:anywhere}
/* Explicit track placement prevents the legacy grid-row:4 focus rule from
   moving the model underneath prices. The action area must stay below it. */
.geometryStrictPrimary .previewPanel>.previewTop{grid-row:1}
.geometryStrictPrimary .previewPanel>.art,.geometryStrictPrimary .previewPanel>.geometryFocus{grid-row:2!important}
.geometryStrictPrimary .previewPanel>.previewState{grid-row:3}
.geometryStrictPrimary .previewPanel>.priceBox{grid-row:4;align-content:start;grid-auto-rows:min-content}
.geometryFocus>.geometryCard{display:flex;flex-direction:column;min-height:0}
.geometryFocus>.geometryCard>.geometryPhoto{flex:1 1 auto;height:auto;min-height:0;aspect-ratio:auto}

/* Full-tree v90: specialist cards and summaries use the same readable rails. */
.builderWorkspace .builderMenu .sectionTitle{display:flex;flex-direction:column;align-items:flex-start;gap:8px}
.builderWorkspace .builderMenu .sectionTitle h2{width:100%;overflow-wrap:normal;word-break:normal}
.builderWorkspace .controls .options{grid-template-columns:minmax(0,1fr)!important}
.builderWorkspace .previewPanel .priceBox{display:flex!important;flex-direction:column;gap:2px}
.builderWorkspace .previewPanel .priceBox .sumRow{display:flex;justify-content:space-between;align-items:baseline;gap:12px;width:100%}
.builderWorkspace .previewPanel .priceBox .sumRow strong{white-space:nowrap}
.builderWorkspace .previewPanel .priceBox .primary,.builderWorkspace .previewPanel .priceBox .resetBuildV86{flex-shrink:0}
.builderWorkspace .previewPanel .art .photoStage{width:100%;height:100%;min-height:0;display:flex;align-items:center;justify-content:center;position:relative}
.builderWorkspace .previewPanel .art .photoStage>img{display:block;position:static!important;width:100%!important;height:auto!important;max-height:100%!important;object-fit:contain}
.builderWorkspace .previewPanel .art .photoCredit{position:absolute;bottom:8px;left:8px}
.builderWorkspace .previewPanel:has(>.geometryFocus[hidden])>.art{display:grid!important}
.builderWorkspace .previewPanel>.geometryFocus[hidden]{display:none!important}
@media(min-width:1200px){
 .builderWorkspace .previewPanel{height:auto!important;min-height:760px;max-height:none!important;grid-template-rows:auto minmax(300px,1fr) auto auto!important;overflow:visible!important}
 .builderWorkspace .previewPanel .art{min-height:300px!important}
}
