.modern-builder { width: min(1560px, calc(100vw - 40px)); margin: 0 auto 72px; color: #172033; }
.builder-hero { text-align: center; padding: 58px 20px 38px; }
.hero-kicker, .panel-kicker { display: block; color: #2563eb; font-size: .72rem; line-height: 1; font-weight: 800; letter-spacing: .14em; }
.builder-hero h1 { margin: 12px 0 10px; color: #111b30; font-size: clamp(2rem, 3.1vw, 3.15rem); line-height: 1.12; letter-spacing: -.045em; }
.builder-hero p { max-width: 690px; margin: 0 auto; color: #667085; font-size: 1rem; line-height: 1.7; }

.workspace-shell { display: grid; grid-template-columns: minmax(190px, .19fr) minmax(0, .5fr) minmax(310px, .31fr); align-items: start; gap: 18px; }
.category-nav, .selection-panel, .prompt-sticky { border: 1px solid #e1e7f0; border-radius: 16px; background: #fff; box-shadow: 0 10px 34px rgba(35, 50, 80, .06); }
.category-nav { padding: 15px; }
.category-label { margin: 4px 8px 12px; color: #98a2b3; font-size: .7rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.category-button { width: 100%; display: flex; align-items: center; gap: 11px; margin: 3px 0; padding: 11px; border: 0; border-radius: 11px; background: transparent; color: #344054; text-align: left; cursor: pointer; }
.category-button:hover { background: #f4f7fc; }
.category-button.active { background: #2563eb; color: #fff; }
.category-icon { flex: 0 0 30px; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: #eef4ff; color: #2563eb; font-size: 1rem; }
.category-button.active .category-icon { background: rgba(255,255,255,.18); color: #fff; }
.category-button strong, .category-button small { display: block; }
.category-button strong { font-size: .86rem; }
.category-button small { margin-top: 2px; color: #98a2b3; font-size: .67rem; }
.category-button.active small { color: #dbe7ff; }

.selection-panel { min-height: 680px; padding: 22px; }
.selection-heading, .prompt-heading, .prompt-box-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.selection-heading h2, .prompt-heading h2 { margin: 7px 0 0; color: #172033; font-size: 1.18rem; letter-spacing: -.02em; }
.selection-total { padding: 6px 9px; border-radius: 999px; background: #eff6ff; color: #2563eb; font-size: .72rem; font-weight: 750; }
.global-search-wrap { display: flex; align-items: center; gap: 9px; margin: 18px 0 14px; padding: 0 13px; border: 1px solid #dce3ee; border-radius: 11px; color: #98a2b3; background: #fbfcfe; }
.global-search-wrap:focus-within { border-color: #70a0ff; box-shadow: 0 0 0 3px rgba(37,99,235,.1); background: #fff; }
.global-search-wrap input { width: 100%; height: 43px; border: 0; outline: 0; background: transparent; color: #172033; font: inherit; }
.category-panel[hidden] { display: none; }
.cb-group-body { display: flex; flex-wrap: wrap; gap: 7px; align-items: flex-start; }
.mc-field { display: contents; }
.mc-toggle { flex: 0 0 auto; width: auto; min-height: 35px; box-sizing: border-box; padding: 8px 11px; border: 1px solid #dbe3ef; border-radius: 999px; background: #fff; color: #475467; font: inherit; font-size: .76rem; font-weight: 700; cursor: pointer; }
.mc-toggle:hover, .mc-field.open .mc-toggle { border-color: #2563eb; background: #eff6ff; color: #1d4ed8; }
.mc-toggle .mc-preview { display: none; }
.mc-panel { flex-basis: 100%; width: 100%; order: 100; margin-top: 7px; }
.mc-tools { display: flex; gap: 8px; margin-bottom: 10px; }
.mc-search { flex: 1; height: 38px; border: 1px solid #dce3ee; border-radius: 9px; padding: 0 11px; }
.mc-clear { border: 1px solid #dce3ee; border-radius: 9px; background: #fff; color: #667085; padding: 0 12px; cursor: pointer; }
.mc-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 9px; }
.mc-chip { display: inline-flex; align-items: center; gap: 4px; padding: 5px 8px; border-radius: 999px; background: #eaf2ff; color: #1d4ed8; font-size: .7rem; }
.mc-chip-remove { border: 0; background: transparent; color: inherit; cursor: pointer; }
.mc-list { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px 7px; max-height: 540px; overflow: auto; padding: 2px 3px 8px; }
.mc-item { position: relative; display: block; overflow: hidden; min-width: 0; border: 1px solid #e0e6ef; border-radius: 12px; background: #fff; cursor: pointer; transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.mc-item:hover { transform: translateY(-2px); border-color: #94b7fa; box-shadow: 0 9px 22px rgba(37,99,235,.11); }
.mc-item input { position: absolute; opacity: 0; pointer-events: none; }
.mc-item:has(input:checked) { border-color: #2563eb; outline: 1px solid #2563eb; background: #eff6ff; box-shadow: 0 0 0 2px rgba(37,99,235,.08); }
.option-thumb { position: relative; display: grid; place-items: center; height: 118px; overflow: hidden; background: linear-gradient(145deg, #eef3fb, #e2eaf7); color: #6880a7; }
.option-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.option-thumb img.is-loading { opacity: 0; }
.option-placeholder { display: grid; place-items: center; width: 100%; height: 100%; background: radial-gradient(circle at 70% 20%, rgba(255,255,255,.8), transparent 35%), linear-gradient(145deg, #edf3fb, #dfe9f7); }
.option-placeholder span { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid rgba(37,99,235,.18); border-radius: 12px; background: rgba(255,255,255,.72); color: #3e64a4; font-size: 1.05rem; font-weight: 800; }
.option-copy { display: block; padding: 2px 8px 3px; }
.mc-item-text { display: -webkit-box; height: 27.5px; overflow: hidden; color: #25324a; font-size: .78rem; line-height: 1.1; font-weight: 750; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow-wrap: anywhere; }
.option-token { display: block; overflow: hidden; margin-top: 1px; color: #98a2b3; font-size: .66rem; line-height: 1.1; text-overflow: ellipsis; white-space: nowrap; }
.mc-item-count { position: absolute; top: 7px; right: 7px; min-width: 20px; padding: 3px 5px; border-radius: 999px; background: rgba(11,23,54,.72); color: #fff; font-size: .58rem; text-align: center; }
.selected-mark { position: absolute; top: 7px; left: 7px; display: none; width: 23px; height: 23px; border-radius: 50%; background: #2563eb; color: #fff; font-size: .75rem; place-items: center; z-index: 2; }
.mc-item:has(input:checked) .selected-mark { display: grid; }
.mc-item[data-table="colors"] .option-thumb, .mc-item[data-table="hair_colors"] .option-thumb, .mc-item[data-table="eye_colors"] .option-thumb { height: 118px; }

.prompt-sticky { position: sticky; top: 86px; padding: 20px; }
.prompt-options { display: grid; grid-template-columns: 1fr 108px; gap: 9px; margin: 16px 0 11px; }
.cb-checkbox-line { display: flex; align-items: center; gap: 7px; padding: 9px 10px; border: 1px solid #e2e7ef; border-radius: 9px; color: #667085; font-size: .72rem; }
.cb-checkbox-line:last-child { grid-column: 1 / -1; }
.compact-field { display: grid; grid-template-columns: 1fr; gap: 4px; color: #667085; font-size: .65rem; }
.compact-field select { min-height: 34px; border: 1px solid #dce3ee; border-radius: 8px; background: #fff; }
.cb-generate-btn { width: 100%; min-height: 43px; border: 0; border-radius: 10px; background: #2563eb; color: #fff; font-weight: 800; cursor: pointer; }
.prompt-box { margin-top: 12px; padding: 13px; border: 1px solid #e0e6ef; border-radius: 12px; background: #fbfcfe; }
.prompt-box h3 { margin: 0; color: #344054; font-size: .78rem; }
.prompt-box-head span { color: #98a2b3; font-size: .66rem; }
.prompt-box textarea { width: 100%; min-height: 125px; margin-top: 8px; resize: vertical; border: 0; outline: 0; background: transparent; color: #344054; font: 500 .76rem/1.65 ui-monospace, SFMono-Regular, Consolas, monospace; }
.secondary-output textarea { min-height: 78px; }
.prompt-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 10px; }
.prompt-actions button { min-height: 38px; border: 1px solid #dce3ee; border-radius: 9px; background: #fff; color: #475467; font-weight: 700; cursor: pointer; }
.prompt-actions button.primary { border-color: #2563eb; background: #2563eb; color: #fff; }
.prompt-actions #clearAllBtn { grid-column: 1 / -1; }
.advanced-options { margin-top: 12px; border-top: 1px solid #e5eaf1; padding-top: 11px; color: #667085; font-size: .75rem; }
.advanced-options summary { cursor: pointer; font-weight: 700; }
.cb-preset-row { display: flex; gap: 6px; margin-top: 8px; }
.cb-preset-row input, .cb-preset-row button { min-height: 35px; border: 1px solid #dce3ee; border-radius: 8px; background: #fff; }
.cb-preset-row input { min-width: 0; flex: 1; padding: 0 9px; }
.prompt-tip { margin-top: 14px; padding: 12px 13px; border-radius: 11px; background: #f0f5ff; color: #52627d; font-size: .7rem; line-height: 1.55; }
.prompt-tip strong { color: #244b8f; }
.prompt-tip ul { margin: 7px 0 0; padding-left: 17px; }
.prompt-tip li + li { margin-top: 3px; }

@media (max-width: 1180px) {
  .mc-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .workspace-shell { grid-template-columns: 190px minmax(0, 1fr); }
  .prompt-panel { grid-column: 1 / -1; }
  .prompt-sticky { position: static; display: grid; grid-template-columns: minmax(260px, .7fr) 1fr 1fr; gap: 13px; }
  .prompt-heading, .prompt-options, .cb-generate-btn, .prompt-actions, .advanced-options, .prompt-tip { grid-column: 1; }
  .primary-output { grid-column: 2; grid-row: 1 / span 6; margin: 0; }
  .secondary-output { grid-column: 3; grid-row: 1 / span 6; margin: 0; }
}

@media (max-width: 820px) {
  .modern-builder { width: min(100% - 24px, 1560px); }
  .builder-hero { padding: 38px 10px 28px; }
  .workspace-shell { grid-template-columns: 1fr; }
  .category-nav { display: flex; overflow-x: auto; padding: 9px; gap: 5px; scrollbar-width: thin; }
  .category-label { display: none; }
  .category-button { flex: 0 0 auto; width: auto; margin: 0; padding: 9px 11px; }
  .category-button small { display: none; }
  .category-icon { width: 27px; height: 27px; flex-basis: 27px; }
  .selection-panel { min-height: 570px; padding: 17px; }
  .prompt-panel { grid-column: auto; }
  .prompt-sticky { display: block; }
  .primary-output, .secondary-output { margin-top: 12px; }
}

@media (max-width: 560px) {
  .modern-builder { width: 100%; }
  .modern-builder, .builder-hero, .workspace-shell, .selection-panel, .prompt-panel { min-width: 0; max-width: 100%; }
  .builder-hero h1 { max-width: 100%; font-size: 1.42rem; word-break: keep-all; overflow-wrap: anywhere; }
  .builder-hero p { max-width: 320px; font-size: .82rem; }
  .mc-list { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: none; }
  .option-thumb, .mc-item[data-table="colors"] .option-thumb, .mc-item[data-table="hair_colors"] .option-thumb, .mc-item[data-table="eye_colors"] .option-thumb { height: 102px; }
  .selection-heading { align-items: center; }
  .global-search-wrap input { font-size: .78rem; }
}
