/* Outil de build The Division 2 - UI "paper-doll" (tuiles cliquables) + modale picker.
   S'appuie sur les variables du thème (main.css). */

.build-tool { --c: #ff7a1a; } /* accent Division */

.bt-head { padding-block: clamp(26px,4vw,44px); border-bottom:1px solid var(--line); }
.bt-head .eyebrow { color: var(--c); }
.bt-head .eyebrow::before { background: var(--c); box-shadow: 0 0 16px var(--c); }
.bt-head h1 { font-size: clamp(1.8rem,4vw,2.8rem); text-transform:uppercase; margin-top:.3rem; }
.bt-head p { color: var(--text-dim); margin-top:.5rem; max-width:64ch; }
.bt-actions { display:flex; gap:.6rem; margin-top:1.2rem; flex-wrap:wrap; }

.bt-layout { display:grid; grid-template-columns: minmax(0,1fr) 340px; gap: var(--gap); padding-block: clamp(24px,4vw,44px); align-items:start; }
.bt-main { min-width:0; }

/* titres de section */
.bt-section-title { font-family:var(--font-display); text-transform:uppercase; letter-spacing:.06em; font-size:.85rem; color:var(--text-mute); margin:0 0 .8rem; display:flex; align-items:center; gap:.6rem; }
.bt-section-title::after { content:""; flex:1; height:1px; background:var(--line); }

/* grille de tuiles (paper-doll) */
.bt-grid { display:grid; grid-template-columns: repeat(3,1fr); gap: var(--gap); }
.bt-grid.weapons { grid-template-columns: repeat(3,1fr); }

/* tuile cliquable */
.tile {
  appearance:none; -webkit-appearance:none; font:inherit; text-align:left; cursor:pointer;
  position:relative; display:flex; align-items:flex-start; gap:.8rem; width:100%;
  min-height:108px; padding:14px; color:var(--text);
  background:
    radial-gradient(120% 100% at 0% 0%, color-mix(in srgb, var(--slot-c, var(--line)) 10%, transparent), transparent 60%),
    var(--surface);
  border:1px solid var(--line); border-left:3px solid var(--slot-c, var(--line));
  border-radius: var(--radius); transition: transform .15s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.tile:hover, .tile:focus-visible {
  transform: translateY(-2px); outline:none;
  border-color: color-mix(in srgb, var(--slot-c, var(--c)) 60%, var(--line));
  box-shadow: 0 6px 22px -12px color-mix(in srgb, var(--slot-c, var(--c)) 80%, transparent);
}
.tile.filled { border-left-color: var(--slot-c, var(--c)); }

.tile-visual {
  width:56px; height:56px; flex-shrink:0; display:grid; place-items:center;
  border:1px solid color-mix(in srgb, var(--slot-c, var(--line)) 45%, var(--line)); border-radius:4px; overflow:hidden;
  background:
    radial-gradient(80% 80% at 50% 0%, color-mix(in srgb, var(--slot-c, var(--c)) 26%, transparent), transparent 70%),
    var(--bg-2);
  color: var(--slot-c, var(--text-mute));
}
.tile-visual svg { width:30px; height:30px; }
.tile-visual img { width:100%; height:100%; object-fit:contain; padding:4px; }

.tile-body { display:flex; flex-direction:column; gap:.2rem; min-width:0; }
.tile-slot { font-family:var(--font-display); text-transform:uppercase; font-size:.72rem; letter-spacing:.06em; color:var(--text-mute); }
.tile-item { font-family:var(--font-display); font-weight:700; font-size:.98rem; line-height:1.15; }
.tile-empty { color:var(--text-mute); font-size:.85rem; font-style:italic; }

.tile-chips { display:flex; flex-wrap:wrap; gap:.3rem; margin-top:.35rem; }
.chip { display:inline-flex; align-items:center; gap:.3em; font-size:.66rem; line-height:1; padding:.32em .5em; border:1px solid var(--line); border-radius:2px; color:var(--text-dim); background:var(--bg-2); white-space:nowrap; }
.chip .dot { width:7px; height:7px; border-radius:50%; }
.chip.core.red .dot { background:#ff5a4d; } .chip.core.red { color:#ff8e85; border-color:color-mix(in srgb,#ff5a4d 40%,var(--line)); }
.chip.core.blue .dot { background:#4aa3ff; } .chip.core.blue { color:#8ec5ff; border-color:color-mix(in srgb,#4aa3ff 40%,var(--line)); }
.chip.core.yellow .dot { background:#f4c430; } .chip.core.yellow { color:#ffdd6b; border-color:color-mix(in srgb,#f4c430 40%,var(--line)); }
.chip.talent { color:var(--c); border-color:color-mix(in srgb,var(--c) 40%,var(--line)); }

.tile-tag { position:absolute; top:10px; right:10px; font-size:.6rem; font-family:var(--font-display); letter-spacing:.08em; text-transform:uppercase; color:var(--slot-c,var(--text-mute)); border:1px solid color-mix(in srgb,var(--slot-c,var(--line)) 45%,var(--line)); padding:.15em .45em; border-radius:2px; }

/* panneau stats / bonus (inchangé) */
.bt-side { position:sticky; top:90px; display:flex; flex-direction:column; gap: var(--gap); }
.panel { background: var(--surface); border:1px solid var(--line); border-radius:var(--radius); padding:16px; }
.panel h3 { font-family:var(--font-display); text-transform:uppercase; font-size:.95rem; letter-spacing:.05em; margin-bottom:.9rem; padding-bottom:.7rem; border-bottom:1px solid var(--line); display:flex; align-items:center; gap:.5rem; }
.panel h3 .dot { width:8px;height:8px;background:var(--c);transform:rotate(45deg);box-shadow:0 0 8px var(--c); }

.stat-row { display:flex; align-items:center; justify-content:space-between; padding:.42rem 0; border-bottom:1px solid var(--line-soft); font-size:.9rem; }
.stat-row:last-child { border-bottom:none; }
.stat-row .k { color: var(--text-dim); }
.stat-row .v { font-family:var(--font-display); font-weight:700; color: var(--text); }
.stat-row .v.hot { color: var(--c); }
.stat-row.core .v { color: var(--accent); }

.bonus-list { display:flex; flex-direction:column; gap:.5rem; }
.bonus-group { font-size:.85rem; }
.bonus-group .bg-name { font-family:var(--font-display); text-transform:uppercase; font-size:.78rem; letter-spacing:.05em; color:var(--c); display:flex; justify-content:space-between; }
.bonus-group .bg-name .pc { color:var(--text-mute); }
.bonus-group ul { list-style:none; padding:0; margin:.35rem 0 0; }
.bonus-group li { color:var(--text-dim); padding:.12rem 0 .12rem .8rem; position:relative; }
.bonus-group li.active { color:var(--text); }
.bonus-group li.active::before { content:"▸"; position:absolute; left:0; color:var(--c); }
.bonus-group li.inactive { color:var(--text-mute); opacity:.5; }
.bonus-group li.inactive::before { content:"·"; position:absolute; left:.2rem; }

.bt-empty { color: var(--text-mute); font-size:.88rem; }
.seed-note { margin-top: var(--gap); padding:12px 14px; border:1px dashed color-mix(in srgb,var(--c) 50%, var(--line)); border-radius:var(--radius); background:color-mix(in srgb,var(--c) 7%, transparent); color:var(--text-dim); font-size:.82rem; }

/* ----------------------------------------------------------- modale picker */
body.bt-modal-open { overflow:hidden; }
.bt-modal-ov {
  position:fixed; inset:0; z-index:1000; display:grid; place-items:center; padding:16px;
  background:color-mix(in srgb, var(--bg) 70%, rgba(0,0,0,.6)); backdrop-filter:blur(4px);
  animation:bt-fade .15s var(--ease);
}
@keyframes bt-fade { from { opacity:0; } to { opacity:1; } }
.bt-modal {
  width:min(760px,100%); max-height:88vh; display:flex; flex-direction:column;
  background:var(--surface); border:1px solid color-mix(in srgb,var(--c) 25%,var(--line));
  border-radius:var(--radius); box-shadow:0 30px 80px -30px rgba(0,0,0,.8); overflow:hidden;
}
.bm-head { display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:14px 18px; border-bottom:1px solid var(--line); flex-shrink:0; }
.bm-title { font-family:var(--font-display); text-transform:uppercase; letter-spacing:.05em; font-size:1.05rem; }
.bm-close { appearance:none; background:var(--bg-2); border:1px solid var(--line); color:var(--text); width:34px; height:34px; border-radius:3px; cursor:pointer; font-size:1rem; line-height:1; transition:border-color .2s var(--ease),color .2s var(--ease); }
.bm-close:hover { border-color:var(--c); color:var(--c); }
.bm-body { padding:18px; overflow:auto; display:flex; flex-direction:column; gap:1.3rem; }

.bm-sec-h { font-family:var(--font-display); text-transform:uppercase; letter-spacing:.05em; font-size:.78rem; color:var(--text-mute); margin-bottom:.6rem; }
.bm-search { width:100%; background:var(--bg-2); border:1px solid var(--line); color:var(--text); padding:.6rem .7rem; border-radius:3px; font:inherit; font-size:.9rem; outline:none; margin-bottom:.7rem; }
.bm-search:focus { border-color:var(--c); }
.bm-hint { font-size:.8rem; line-height:1.35; color:#ffdd6b; background:color-mix(in srgb,#f4c430 10%,transparent); border:1px solid color-mix(in srgb,#f4c430 35%,var(--line)); border-radius:3px; padding:.5rem .65rem; margin:0 0 .7rem; }

.bm-opts { display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:.5rem; max-height:300px; overflow:auto; padding-right:.2rem; }
.bm-opt {
  appearance:none; cursor:pointer; font:inherit; text-align:left; color:var(--text);
  display:flex; align-items:center; gap:.55rem; padding:.5rem .6rem;
  background:var(--bg-2); border:1px solid var(--line); border-left:3px solid var(--line); border-radius:3px;
  transition:border-color .15s var(--ease), background .15s var(--ease);
}
.bm-opt:hover { border-color:color-mix(in srgb,var(--c) 50%,var(--line)); }
.bm-opt.brand { border-left-color:#f4c430; }
.bm-opt.set { border-left-color:#4ec06f; }
.bm-opt.exotic { border-left-color:var(--c); }
.bm-opt.on { background:color-mix(in srgb,var(--c) 14%,var(--bg-2)); border-color:var(--c); }
.bm-opt.none { grid-column:1/-1; justify-content:center; border-left-color:var(--line); color:var(--text-mute); }
.bm-opt-ic { width:34px; height:34px; flex-shrink:0; display:grid; place-items:center; border:1px solid var(--line); border-radius:3px; overflow:hidden; background:var(--bg); color:var(--text-mute); }
.bm-opt-ic svg { width:20px; height:20px; }
.bm-opt-ic img { width:100%; height:100%; object-fit:contain; padding:3px; }
.bm-opt-n { flex:1; min-width:0; font-weight:600; font-size:.84rem; line-height:1.15; overflow:hidden; text-overflow:ellipsis; }
.bm-opt-k { font-size:.6rem; text-transform:uppercase; letter-spacing:.06em; color:var(--text-mute); flex-shrink:0; }

/* core toggles */
.bm-cores { display:grid; grid-template-columns:repeat(3,1fr); gap:.5rem; }
.bm-core { appearance:none; cursor:pointer; font:inherit; color:var(--text); display:flex; align-items:center; justify-content:center; gap:.45rem; padding:.7rem .6rem; background:var(--bg-2); border:1px solid var(--line); border-radius:3px; font-size:.84rem; transition:border-color .15s var(--ease),background .15s var(--ease); }
.bm-core .dot { width:9px; height:9px; border-radius:50%; }
.bm-core.red .dot { background:#ff5a4d; } .bm-core.blue .dot { background:#4aa3ff; } .bm-core.yellow .dot { background:#f4c430; }
.bm-core:hover { border-color:var(--text-mute); }
.bm-core.red.on { border-color:#ff5a4d; background:color-mix(in srgb,#ff5a4d 14%,var(--bg-2)); }
.bm-core.blue.on { border-color:#4aa3ff; background:color-mix(in srgb,#4aa3ff 14%,var(--bg-2)); }
.bm-core.yellow.on { border-color:#f4c430; background:color-mix(in srgb,#f4c430 14%,var(--bg-2)); }

/* attributs secondaires */
.bm-attr { display:flex; align-items:center; gap:.7rem; margin-bottom:.5rem; }
.bm-attr label { width:88px; flex-shrink:0; font-size:.72rem; text-transform:uppercase; letter-spacing:.05em; color:var(--text-mute); }
.bm-attr select { flex:1; min-width:0; background:var(--bg-2); border:1px solid var(--line); color:var(--text); padding:.5rem .6rem; border-radius:3px; font:inherit; font-size:.86rem; outline:none; cursor:pointer; }
.bm-attr select:focus { border-color:var(--c); }

/* talents */
.bm-talents { display:flex; flex-direction:column; gap:.4rem; }
.bm-tal { appearance:none; cursor:pointer; font:inherit; text-align:left; color:var(--text); display:flex; flex-direction:column; gap:.2rem; padding:.6rem .7rem; background:var(--bg-2); border:1px solid var(--line); border-left:3px solid var(--line); border-radius:3px; transition:border-color .15s var(--ease),background .15s var(--ease); }
.bm-tal:hover { border-color:color-mix(in srgb,var(--c) 50%,var(--line)); }
.bm-tal.on { border-left-color:var(--c); border-color:var(--c); background:color-mix(in srgb,var(--c) 12%,var(--bg-2)); }
.bm-tal-n { font-family:var(--font-display); font-weight:600; font-size:.88rem; }
.bm-tal-d { font-size:.78rem; color:var(--text-dim); line-height:1.3; }

/* footer modale */
.bm-foot { display:flex; justify-content:space-between; gap:.6rem; padding-top:.4rem; margin-top:.2rem; border-top:1px solid var(--line); }
.bm-foot .btn { flex:0 0 auto; }

/* toast informatif (règle exotiques) */
.bt-notice {
  position:fixed; left:50%; bottom:24px; transform:translate(-50%, 140%); z-index:1100;
  max-width:min(440px,calc(100% - 32px)); padding:.7rem 1rem;
  background:var(--surface); border:1px solid color-mix(in srgb,var(--c) 45%,var(--line)); border-left:3px solid var(--c);
  border-radius:var(--radius); box-shadow:0 18px 50px -20px rgba(0,0,0,.8);
  color:var(--text); font-size:.86rem; line-height:1.35; opacity:0; pointer-events:none;
  transition:transform .28s var(--ease), opacity .28s var(--ease);
}
.bt-notice.show { transform:translate(-50%, 0); opacity:1; }

/* ----------------------------------------------------------- responsive */
@media (max-width: 980px) {
  .bt-layout { grid-template-columns:1fr; }
  .bt-side { position:static; }
}
@media (max-width: 640px) {
  .bt-grid, .bt-grid.weapons { grid-template-columns:repeat(2,1fr); }
  .tile { min-height:96px; flex-direction:column; gap:.5rem; }
  .tile-tag { position:static; align-self:flex-start; }
  .bt-head .bt-actions .btn { flex:1; text-align:center; justify-content:center; }
  .bt-modal-ov { padding:0; }
  .bt-modal { width:100%; max-height:100vh; height:100vh; border-radius:0; border:none; }
  .bm-opts { max-height:none; grid-template-columns:1fr 1fr; }
  .bm-foot { position:sticky; bottom:0; background:var(--surface); }
}

/* Tooltip au survol des tuiles : objet + bonus octroyés */
.tile { overflow: visible; }
.tile-tip { position:absolute; left:0; right:0; top:calc(100% + 8px); z-index:40; display:none; padding:11px 13px; font-size:.78rem; line-height:1.45; text-align:left; color:var(--text-dim); background:var(--bg-2); border:1px solid color-mix(in srgb, var(--slot-c, var(--c)) 50%, var(--line)); border-radius:var(--radius); box-shadow:0 16px 36px -14px rgba(0,0,0,.92); pointer-events:none; }
.tile:hover .tile-tip { display:block; }
.tile-tip .tt-name { display:block; font-family:var(--font-display); color:var(--text); margin-bottom:.45rem; padding-bottom:.4rem; border-bottom:1px solid var(--line); }
.tile-tip .tt-kind { font-family:var(--font-mono); font-size:.64rem; color:var(--slot-c, var(--text-mute)); text-transform:uppercase; margin-left:.3rem; }
.tile-tip .tt-row { display:block; padding:.12rem 0; }
.tile-tip .tt-row b { color:var(--slot-c, var(--c)); font-family:var(--font-mono); font-weight:500; font-size:.68rem; margin-right:.35rem; }
.tile-tip .tt-eq { color:var(--text-mute); font-size:.72rem; }
@media (hover: none) { .tile-tip { display:none !important; } }
