/* ==========================================================================
   TGP Texture Creator — /tgp_launcher/texture-creator (v16)
   Outil intégré à la page : couleurs et formes du thème TGP Launcher.
   Tout est rangé sous .tx pour ne rien changer au reste du site.
   ========================================================================== */
.tx{
  --tx-soft:rgba(243,238,251,.06);--tx-soft-hi:rgba(243,238,251,.12);
  --tx-card:rgba(243,238,251,.04);
  max-width:1500px;display:grid;gap:1rem;padding-bottom:2.5rem;
}
.tx [hidden]{display:none}

/* En-tête */
.tx-head{display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:space-between;gap:1rem 2rem;margin-bottom:.3rem}
.tx-title{font-size:clamp(1.8rem,3vw,2.4rem);font-weight:700;letter-spacing:-.025em;line-height:1.1}
.tx-lead{margin-top:.4rem;color:var(--tgp-mute);max-width:64ch}
.tx-head__tools{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem}
.tx-switch{display:inline-flex;align-items:center;gap:.6rem;min-height:44px;padding:0 .9rem;border:0;border-radius:10px;background:var(--tx-soft);color:var(--tgp-paper);font:600 .9rem var(--tgp-font);cursor:pointer}
.tx-switch:hover{background:var(--tx-soft-hi)}
.tx-switch__dot{position:relative;width:30px;height:18px;border-radius:18px;background:rgba(243,238,251,.2);transition:background .15s}
.tx-switch__dot::after{content:"";position:absolute;top:2px;left:2px;width:14px;height:14px;border-radius:50%;background:var(--tgp-paper);transition:transform .15s}
.tx-switch[aria-pressed="true"] .tx-switch__dot{background:var(--tgp-ember)}
.tx-switch[aria-pressed="true"] .tx-switch__dot::after{transform:translateX(12px)}
.perf-banner{display:none;padding:.6rem .9rem;border-radius:10px;background:rgba(255,182,72,.12);color:#ffcf8a;font-size:.88rem;font-weight:600}
.perf-banner.on{display:block}

/* Cartes */
.tx-card{padding:1.1rem 1.2rem;border-radius:14px;background:var(--tx-card);border:1px solid var(--tgp-line)}
.tx-card__head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:.6rem;margin-bottom:.8rem}
.tx-card__head .sl{margin:0}
.tx .sl{margin:0 0 .8rem;font:700 .95rem var(--tgp-font);letter-spacing:-.01em;color:var(--tgp-paper)}
.tx #activeName{color:var(--tgp-mute);font-weight:500}
.tx-link{border:0;background:none;padding:0;color:var(--tgp-mute);font:600 .82rem var(--tgp-font);cursor:pointer;text-decoration:underline;text-underline-offset:3px}
.tx-link:hover{color:var(--tgp-ember)}
.tx-hint{display:none;margin-top:.7rem;color:var(--tgp-mute);font-size:.84rem}
.tx[data-view="tile"] .tx-hint--tile,.tx[data-view="lit"] .tx-hint--lit{display:block}
.tx-foot{color:var(--tgp-mute);font-size:.8rem;text-align:center}

/* Textures chargées */
.tx .strip{display:flex;flex-wrap:wrap;align-items:center;gap:.7rem;min-height:92px;padding:.8rem;border-radius:12px;border:1.5px dashed var(--tgp-line-hi);transition:border-color .15s,background .15s}
.tx.is-drag .strip{border-color:var(--tgp-ember);background:rgba(254,94,227,.07)}
.tx:not(.has-tex) .strip{min-height:170px;justify-content:center;flex-direction:column;text-align:center}
.tx .add-btn{position:relative;flex:none;display:grid;place-items:center;width:72px;height:72px;border-radius:12px;background:var(--tx-soft-hi);color:var(--tgp-paper);font-size:1.6rem;cursor:pointer;transition:background .15s}
.tx .add-btn:hover,.tx .add-btn:focus-within{background:var(--tgp-ember);color:var(--tgp-ink)}
.tx .add-btn input,.tx .conv-drop input{position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer}
.tx .strip-empty{color:var(--tgp-mute);font-size:.92rem}
.tx .tex-card{position:relative;width:96px;border-radius:10px;overflow:hidden;background:var(--tx-soft);cursor:pointer;outline:2px solid transparent;outline-offset:2px;transition:outline-color .15s}
.tx .tex-card img{display:block;width:100%;height:72px;object-fit:cover}
.tx .tex-card .tn{padding:.25rem .4rem;font-size:.7rem;color:var(--tgp-mute);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tx .tex-card.active{outline-color:var(--tgp-ember)}
.tx .tex-card.active .tn{color:var(--tgp-paper)}
.tx .tex-del{position:absolute;top:4px;right:4px;width:22px;height:22px;border:0;border-radius:50%;background:rgba(13,17,23,.82);color:var(--tgp-paper);font-size:.9rem;line-height:1;cursor:pointer;opacity:0;transition:opacity .15s}
.tx .tex-card:hover .tex-del,.tx .tex-del:focus-visible{opacity:1}
.tx .tex-del:hover{background:#ff6b7d;color:#170a10}

/* Zone de travail : réglages à gauche, aperçu à droite */
.tx-work{display:none;gap:1rem;align-items:flex-start}
.tx-work.anim-in{animation:tx-in .25s ease}
@keyframes tx-in{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
.tx-side{flex:0 0 380px;display:grid;gap:1rem;min-width:0}
.tx-stage{flex:1;min-width:0;position:sticky;top:84px}

/* Types de map */
.tx .tabs{display:flex;flex-wrap:wrap;gap:.4rem}
.tx .tab-group{flex:0 0 100%;margin:.5rem 0 0;color:var(--tgp-mute);font-size:.72rem;font-weight:700;letter-spacing:.04em;text-transform:uppercase}
.tx .tab-group:first-child{margin-top:0}
.tx .tab,.tx .mbtn,.tx .pbtn{border:0;border-radius:8px;padding:.45rem .75rem;background:var(--tx-soft);color:var(--tgp-mute);font:600 .84rem var(--tgp-font);cursor:pointer;transition:background .15s,color .15s}
.tx .tab:hover,.tx .mbtn:hover,.tx .pbtn:hover{background:var(--tx-soft-hi);color:var(--tgp-paper)}
.tx .tab.active,.tx .mbtn.active,.tx .pbtn.cur{background:var(--tgp-paper);color:var(--tgp-ink)}

/* Réglages */
.tx .params{display:grid;gap:.75rem}
.tx .prow{display:grid;grid-template-columns:minmax(96px,34%) minmax(0,1fr) auto;align-items:center;gap:.7rem;font-size:.88rem}
.tx .prow>label{color:var(--tgp-mute)}
.tx .prow>.chk-lbl{grid-column:1 / -1;display:flex;align-items:center;gap:.5rem;color:var(--tgp-paper);cursor:pointer}
.tx .prow>.mode-row,.tx .prow>.presets,.tx .prow>.sinputs,.tx .prow>.rinfo{grid-column:2 / -1}
.tx .mode-row,.tx .presets{display:flex;flex-wrap:wrap;gap:.35rem}
.tx .sinputs{display:flex;align-items:center;gap:.4rem;color:var(--tgp-mute)}
.tx .sinput{width:84px;min-height:36px;padding:0 .55rem;border-radius:8px;border:1px solid var(--tgp-line);background:var(--tx-soft);color:var(--tgp-paper);font:inherit;color-scheme:dark}
.tx .val{min-width:3.2em;text-align:right;font-variant-numeric:tabular-nums;color:var(--tgp-paper);font-weight:600}
.tx .rinfo{color:var(--tgp-mute);font-size:.84rem}
.tx .psep{height:1px;background:var(--tgp-line)}
.tx input[type=range]{-webkit-appearance:none;appearance:none;width:100%;height:4px;border-radius:4px;background:rgba(243,238,251,.16);outline:none;cursor:pointer}
.tx input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;width:16px;height:16px;border-radius:50%;border:0;background:var(--tgp-ember)}
.tx input[type=range]::-moz-range-thumb{width:16px;height:16px;border-radius:50%;border:0;background:var(--tgp-ember)}
.tx input[type=checkbox]{width:17px;height:17px;accent-color:var(--tgp-ember)}
.tx input[type=color]{width:44px;height:30px;padding:0;border:1px solid var(--tgp-line-hi);border-radius:8px;background:none;cursor:pointer}
.tx :is(button,input,a,label):focus-visible{outline:2px solid var(--tgp-ember);outline-offset:2px}

/* Aperçu */
.tx-seg{display:inline-flex;gap:2px;padding:3px;border-radius:10px;background:var(--tx-soft)}
.tx-seg button{border:0;border-radius:8px;padding:.38rem .75rem;background:none;color:var(--tgp-mute);font:600 .82rem var(--tgp-font);cursor:pointer}
.tx-seg button:hover{color:var(--tgp-paper)}
.tx-seg button.active{background:var(--tgp-paper);color:var(--tgp-ink)}
.tx .pgrid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.8rem}
.tx .cwrap{position:relative;display:grid;place-items:center;min-height:180px;border-radius:12px;overflow:hidden;background:
  repeating-conic-gradient(rgba(243,238,251,.05) 0 25%,transparent 0 50%) 0 0/20px 20px,#0a0812}
.tx .cwrap canvas{display:block;max-width:100%;max-height:min(62vh,640px);width:auto;height:auto}
.tx .cwrap--lit canvas{width:100%;height:auto;cursor:crosshair;image-rendering:auto}
.tx .ctag{position:absolute;top:.5rem;left:.5rem;padding:.18rem .5rem;border-radius:6px;background:rgba(13,17,23,.82);font-size:.68rem;font-weight:700;letter-spacing:.05em;color:var(--tgp-paper)}
.tx .cwrap--tile,.tx .cwrap--lit{display:none}
.tx[data-view="tile"] .cwrap--result,.tx[data-view="lit"] .cwrap--result{display:none}
.tx[data-view="tile"] .cwrap--tile,.tx[data-view="lit"] .cwrap--lit{display:grid}

/* Boutons et export */
.tx .actions{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem;margin-top:.9rem}
.tx .btn{min-height:42px;padding:0 1rem;border:0;border-radius:10px;background:var(--tx-soft-hi);color:var(--tgp-paper);font:600 .9rem var(--tgp-font);cursor:pointer;transition:background .15s}
.tx .btn:hover{background:rgba(243,238,251,.2)}
.tx .btn.primary{background:var(--tgp-ember);color:var(--tgp-ink)}
.tx .btn.primary:hover{background:var(--tgp-ember-hi,#ff8aec)}
.tx .status-bar{color:var(--tgp-mute);font-size:.82rem}
.tx .exp-checks{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:.45rem .8rem}
.tx .exp-check{display:flex;align-items:center;gap:.5rem;font-size:.88rem;cursor:pointer}

/* Convertisseur */
.tx .conv-drop{position:relative;display:grid;place-items:center;min-height:96px;border-radius:12px;border:1.5px dashed var(--tgp-line-hi);text-align:center;transition:border-color .15s,background .15s}
.tx .conv-drop:hover{border-color:var(--tgp-ember);background:rgba(254,94,227,.05)}
.tx #convWork{display:none;flex-direction:column;gap:.9rem;margin-top:1rem}

/* Mode performance : pas d'animation ni de transition */
.tx.is-perf *,.tx.is-perf *::after{transition:none!important;animation:none!important}

@media (max-width:1050px){
  .tx-work{flex-direction:column}
  .tx-side{flex:none;width:100%;order:2}
  .tx-stage{position:static;width:100%}
}
@media (max-width:560px){.tx .pgrid{grid-template-columns:1fr}.tx .prow{grid-template-columns:1fr auto}.tx .prow>label{grid-column:1 / -1}}
@media (prefers-reduced-motion:reduce){.tx *{transition:none!important;animation:none!important}}
