/* Page Outils (demande 2026-10-16, parité discotools.xyz) : éditeurs React
   (react-island/src/tools) en classes te-*, indépendantes du Tailwind CDN. */

.tl-wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.tl-hero { text-align: center; margin: .5rem auto 1.5rem; max-width: 720px; }
.tl-hero h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); font-weight: 900; letter-spacing: -.02em; line-height: 1.1; }
.tl-hero p { color: var(--text-muted); margin-top: .5rem; }
.tl-hero small { display: block; color: var(--text-muted); opacity: .7; font-size: .75rem; margin-top: .35rem; }
.tl-tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin-bottom: 1.25rem; }
.tl-tab {
  display: inline-flex; align-items: center; gap: .5rem; padding: .55rem 1.05rem; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text-muted); font-weight: 600; font-size: .88rem;
  background: transparent; transition: background .15s, color .15s, border-color .15s;
}
.tl-tab:hover { color: var(--text); border-color: var(--border-strong); }
.tl-tab.is-on { background: #5865f2; color: #fff; border-color: transparent; }
.tl-panel[hidden] { display: none; }

/* ---------- éditeurs ---------- */
.te-editor { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 1.25rem; align-items: start; }
@media (max-width: 960px) { .te-editor { grid-template-columns: 1fr; } .te-side { order: -1; } }

.te-panel { background: var(--card); border: 1px solid var(--border); border-radius: 18px; overflow: hidden; min-width: 0; }
.te-tabs { display: flex; background: rgba(0,0,0,.25); border-bottom: 1px solid var(--border); }
.te-tabs button {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .95rem .6rem;
  font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted);
  background: transparent; border-bottom: 2px solid transparent; white-space: nowrap;
}
.te-tabs button:hover { color: var(--text); }
.te-tabs button.is-on { color: var(--text); background: var(--card); border-bottom-color: #5865f2; }
.te-count { font-style: normal; font-size: .7rem; background: rgba(255,255,255,.12); border-radius: 999px; padding: .05rem .45rem; }
.te-body { padding: 1.1rem; }
@media (max-width: 520px) { .te-tabs button span { display: none; } .te-tabs button { font-size: 1rem; } .te-body { padding: .8rem; } }

.te-stack { display: flex; flex-direction: column; gap: .7rem; }
.te-row { display: flex; align-items: center; gap: .6rem; }
.te-wrap { flex-wrap: wrap; align-items: flex-end; }
.te-grow { flex: 1; min-width: 0; }
.te-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
@media (max-width: 520px) { .te-grid2 { grid-template-columns: 1fr; } }
.te-full { width: 100%; }

.te-label { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); margin-top: .3rem; }
.te-label-hint { text-transform: none; letter-spacing: 0; font-weight: 500; opacity: .7; margin-left: .4rem; }
.te-label-inline { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.te-sublabel { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); opacity: .8; margin-bottom: .35rem; }

.te-input, .te-select {
  background: rgba(0,0,0,.28); border: 1px solid var(--border); border-radius: 10px; color: var(--text);
  padding: .55rem .75rem; font-size: .88rem; min-width: 0;
}
.te-input:focus, .te-select:focus { outline: none; border-color: #5865f2; }
.te-select option { background: #232428; color: var(--text); }

.te-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .6rem 1rem; border-radius: 10px;
  font-size: .85rem; font-weight: 600; border: 1px solid transparent; cursor: pointer; transition: filter .15s, background .15s;
}
.te-btn:disabled { opacity: .4; cursor: default; }
.te-btn-primary { background: #5865f2; color: #fff; }
.te-btn-green { background: #23a55a; color: #fff; }
.te-btn-primary:hover:not(:disabled), .te-btn-green:hover:not(:disabled) { filter: brightness(1.1); }
.te-btn-soft { background: rgba(255,255,255,.08); color: var(--text); font-size: .78rem; padding: .45rem .75rem; }
.te-btn-soft:hover { background: rgba(255,255,255,.14); }
.te-btn-ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.te-btn-ghost:hover:not(:disabled) { background: rgba(255,255,255,.06); }
.te-btn-block { width: 100%; }
.te-icon-btn {
  width: 30px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.06); color: var(--text-muted); font-size: .8rem; flex-shrink: 0;
}
.te-icon-btn:hover:not(:disabled) { color: var(--text); background: rgba(255,255,255,.12); }
.te-icon-btn:disabled { opacity: .3; }
.te-danger { background: rgba(237,66,69,.18); color: #f38688; }
.te-danger:hover:not(:disabled) { background: rgba(237,66,69,.32); color: #fff; }
[dir="rtl"] .te-flip { transform: scaleX(-1); }

/* curseur + valeur */
.te-range { display: grid; grid-template-columns: minmax(60px, auto) 1fr 74px; align-items: center; gap: .7rem; }
.te-range-label { font-size: .75rem; color: var(--text-muted); }
.te-range input[type=range] { width: 100%; accent-color: #5865f2; }
.te-range-num { position: relative; }
.te-range-num input { width: 100%; background: rgba(0,0,0,.28); border: 1px solid var(--border); border-radius: 8px; color: var(--text); padding: .3rem .5rem; font-size: .8rem; }
.te-range-num em { position: absolute; right: .5rem; top: 50%; transform: translateY(-50%); font-style: normal; font-size: .7rem; color: var(--text-muted); pointer-events: none; }
.te-range-num input::-webkit-inner-spin-button { opacity: .4; }

/* interrupteur */
.te-toggle { display: inline-flex; align-items: center; gap: .6rem; cursor: pointer; user-select: none; }
.te-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.te-toggle-track { width: 42px; height: 24px; border-radius: 999px; background: rgba(255,255,255,.16); position: relative; transition: background .15s; flex-shrink: 0; }
.te-toggle-track span { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; }
.te-toggle input:checked + .te-toggle-track { background: #23a55a; }
.te-toggle input:checked + .te-toggle-track span { transform: translateX(18px); }
[dir="rtl"] .te-toggle input:checked + .te-toggle-track span { transform: translateX(-18px); }
[dir="rtl"] .te-toggle-track span { left: auto; right: 3px; }
.te-toggle input:focus-visible + .te-toggle-track { outline: 2px solid #5865f2; outline-offset: 2px; }
.te-toggle-text { font-size: .85rem; }

/* segmenté */
.te-seg { display: inline-flex; background: rgba(0,0,0,.28); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; max-width: 100%; }
.te-seg button { padding: .42rem .8rem; border-radius: 7px; font-size: .8rem; font-weight: 600; color: var(--text-muted); background: transparent; white-space: nowrap; flex: 1; }
.te-seg button:hover { color: var(--text); }
.te-seg button.is-on { background: rgba(35,165,90,.28); color: #fff; box-shadow: inset 0 0 0 1px rgba(35,165,90,.6); }

/* couleurs */
.te-paint { display: flex; flex-direction: column; gap: .55rem; }
.te-paint-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.te-color { width: 52px; height: 34px; border-radius: 9px; border: 2px solid rgba(255,255,255,.85); display: inline-block; position: relative; cursor: pointer; flex-shrink: 0; box-shadow: 0 0 0 1px rgba(0,0,0,.4); }
.te-color input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.te-swatches { display: flex; flex-wrap: wrap; gap: 5px; }
.te-swatches button { width: 20px; height: 20px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); }
.te-swatches button:hover { transform: scale(1.15); }

/* bibliothèque d'icônes */
.te-search { display: flex; gap: .5rem; background: rgba(0,0,0,.28); border: 1px solid var(--border); border-radius: 12px; padding: .25rem; }
.te-search-input { flex: 1; display: flex; align-items: center; gap: .55rem; padding: 0 .6rem; color: var(--text-muted); min-width: 0; }
.te-search-input input { flex: 1; background: transparent; border: 0; color: var(--text); padding: .5rem 0; font-size: .88rem; min-width: 0; }
.te-search-input input:focus { outline: none; }
.te-search .te-select { border: 0; border-left: 1px solid var(--border); border-radius: 0 10px 10px 0; background: transparent; max-width: 46%; }
[dir="rtl"] .te-search .te-select { border-left: 0; border-right: 1px solid var(--border); border-radius: 10px 0 0 10px; }
.te-icongrid { display: flex; flex-direction: column; gap: .8rem; }
.te-icongrid-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; font-size: .92rem; }
.te-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.te-icons { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 8px; }
.te-icons button {
  aspect-ratio: 1; border-radius: 9px; border: 1px solid var(--border-strong); background: rgba(255,255,255,.02);
  color: var(--text); font-size: 1.1rem; display: flex; align-items: center; justify-content: center; transition: background .12s, transform .12s;
}
.te-icons button:hover { background: rgba(255,255,255,.1); transform: translateY(-1px); }
.te-icons button.is-on { background: #5865f2; border-color: #5865f2; color: #fff; }
.te-pager { display: flex; align-items: center; justify-content: space-between; gap: .5rem; font-size: .82rem; color: var(--text-muted); }
.te-pager .te-btn { padding: .45rem .8rem; }
.te-pager .te-btn:not(:disabled):last-child { background: #23a55a; border-color: #23a55a; color: #fff; }
.te-empty { text-align: center; color: var(--text-muted); font-size: .85rem; padding: 1.5rem 0; }

/* formes */
.te-shapes { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 8px; }
.te-shapes button {
  aspect-ratio: 1; border-radius: 10px; border: 1px solid var(--border-strong); color: var(--text); display: flex;
  align-items: center; justify-content: center; padding: 9px; background: transparent;
}
.te-shapes button svg { width: 100%; height: 100%; }
.te-shapes button:hover { background: rgba(255,255,255,.07); }
.te-shapes button.is-on { background: #5865f2; border-color: #5865f2; color: #fff; }
.te-bshapes { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.te-bshapes button { border-radius: 10px; border: 1px solid var(--border-strong); padding: .6rem .4rem; display: flex; justify-content: center; background: transparent; }
.te-bshapes button img { width: 84px; height: 26px; }
.te-bshapes button:hover { background: rgba(255,255,255,.06); }
.te-bshapes button.is-on { border-color: #5865f2; background: rgba(88,101,242,.22); box-shadow: inset 0 0 0 1px #5865f2; }

.te-card { background: rgba(0,0,0,.22); border: 1px solid var(--border); border-radius: 14px; padding: .9rem; }
.te-card-head { display: flex; align-items: center; justify-content: space-between; }
.te-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; }

/* calques */
.te-addcard { display: flex; align-items: center; gap: .85rem; border: 1.5px dashed var(--border-strong); border-radius: 14px; padding: .85rem 1rem; text-align: start; background: transparent; color: var(--text); }
.te-addcard:hover { background: rgba(255,255,255,.04); }
.te-addcard strong { display: block; font-size: .92rem; }
.te-addcard small { color: var(--text-muted); font-size: .76rem; }
.te-addcard-plus { width: 38px; height: 38px; border-radius: 10px; background: rgba(255,255,255,.08); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.te-layer { padding: 0; }
.te-layer.is-sel { border-color: #5865f2; box-shadow: 0 0 0 1px #5865f2; }
.te-layer-head { display: flex; align-items: center; gap: .7rem; padding: .7rem .8rem; cursor: pointer; }
.te-layer-ic { width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--border-strong); display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden; }
.te-layer-ic img { width: 100%; height: 100%; object-fit: cover; }
.te-layer-name { flex: 1; min-width: 0; }
.te-layer-name strong { display: block; font-size: .9rem; text-transform: capitalize; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.te-layer-name small { display: block; font-size: .72rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.te-layer-tools { display: flex; gap: 4px; }
.te-chev { color: var(--text-muted); font-size: .75rem; }
.te-layer-body { padding: .2rem .9rem 1rem; border-top: 1px solid var(--border); padding-top: .8rem; }
@media (max-width: 520px) { .te-layer-tools .te-icon-btn:not(.te-danger) { display: none; } }

/* aperçus */
.te-side { display: flex; flex-direction: column; gap: .9rem; min-width: 0; position: sticky; top: 1rem; }
@media (max-width: 960px) { .te-side { position: static; } }
.te-checker {
  border-radius: 16px; overflow: hidden;
  background-color: #d5d9de;
  background-image: linear-gradient(45deg, #b9bec5 25%, transparent 25%), linear-gradient(-45deg, #b9bec5 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #b9bec5 75%), linear-gradient(-45deg, transparent 75%, #b9bec5 75%);
  background-size: 22px 22px; background-position: 0 0, 0 11px, 11px -11px, -11px 0;
}
.te-stage { display: flex; align-items: center; justify-content: center; padding: 1.25rem; }
.te-canvas { width: min(260px, 70vw); height: auto; aspect-ratio: 1; touch-action: none; cursor: grab; }
.te-canvas:active { cursor: grabbing; }
.te-stage-badge { direction: ltr; padding: 1.4rem 1rem; min-height: 96px; overflow-x: auto; }
.te-badge-canvas { height: 48px; width: auto; max-width: 100%; object-fit: contain; }
.te-hint { font-size: .74rem; color: var(--text-muted); text-align: center; margin-top: -.4rem; }
.te-note { font-size: .74rem; color: var(--text-muted); line-height: 1.45; }
.te-download { display: flex; flex-direction: column; gap: .5rem; }
.te-download .te-seg { width: 100%; }

.te-discord { background: #313338; border-radius: 14px; padding: .9rem .9rem .6rem; color: #dbdee1; font-family: 'gg sans', 'Noto Sans', system-ui, sans-serif; }
.te-msg { display: flex; gap: .75rem; padding: .35rem 0; }
.te-avatar { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; object-fit: cover; }
.te-avatar-sm { width: 30px; height: 30px; }
.te-msg-head { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
.te-msg-name { font-weight: 600; font-size: .95rem; color: #f2f3f5; }
.te-roleicon { width: 20px; height: 20px; }
.te-msg-time { font-size: .7rem; color: #949ba4; margin-left: .2rem; }
.te-msg-text { font-size: .9rem; line-height: 1.35; color: #dbdee1; }
.te-members { margin-top: .5rem; padding-top: .6rem; border-top: 1px solid rgba(255,255,255,.06); }
.te-members-title { font-size: .7rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #949ba4; margin-bottom: .4rem; }
.te-member { display: flex; align-items: center; gap: .55rem; padding: .3rem .4rem; border-radius: 6px; background: rgba(255,255,255,.04); }
.te-member .te-msg-name { font-size: .9rem; font-weight: 500; }

.te-profile { background: #232428; border-radius: 14px; overflow: hidden; color: #dbdee1; }
.te-profile-banner { height: 70px; }
.te-profile-top { display: flex; align-items: flex-end; justify-content: space-between; padding: 0 1rem; margin-top: -40px; }
.te-profile-avatar { position: relative; width: 84px; height: 84px; border-radius: 50%; border: 6px solid #232428; background: #232428; }
.te-profile-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.te-profile-avatar i { position: absolute; right: -2px; bottom: 2px; width: 22px; height: 22px; border-radius: 50%; background: #23a55a; border: 5px solid #232428; }
.te-profile-badges { display: flex; gap: .35rem; background: #111214; border-radius: 8px; padding: .3rem .45rem; margin-bottom: .2rem; font-size: .85rem; }
.te-profile-body { margin: .75rem; background: #111214; border-radius: 10px; padding: .85rem; display: flex; flex-direction: column; gap: .5rem; }
.te-profile-name { font-size: 1.2rem; font-weight: 700; color: #f2f3f5; }
.te-profile-handle { font-size: .85rem; margin-top: -.45rem; }
.te-profile-body hr { border: 0; border-top: 1px solid rgba(255,255,255,.08); margin: .1rem 0; }
.te-profile-section { font-size: .72rem; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; color: #f2f3f5; }
/* Les émojis se suivent toujours de gauche à droite, même en arabe. */
.te-profile-emojis { display: flex; flex-wrap: wrap; min-height: 22px; direction: ltr; justify-content: flex-start; }
[dir="rtl"] .te-profile-emojis { justify-content: flex-end; }
.te-profile-emojis img { width: 22px; height: 22px; }
.te-code { direction: ltr; text-align: left; display: block; font-size: .72rem; background: rgba(0,0,0,.35); border-radius: 6px; padding: .4rem .5rem; word-break: break-all; color: #b5bac1; }
.te-steps { font-size: .78rem; color: var(--text-muted); padding-inline-start: 1.1rem; list-style: decimal; display: flex; flex-direction: column; gap: .3rem; }
.te-icon-pick { width: 52px; height: 34px; border-radius: 9px; border: 1px solid var(--border-strong); color: var(--text); background: rgba(255,255,255,.04); }
.te-icon-pick.is-on, .te-icon-pick:hover { border-color: #5865f2; background: rgba(88,101,242,.2); }

/* outils simples (ID, timestamps) */
.tl-card { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 1.25rem; }
.tl-card h2 { font-weight: 800; font-size: 1.1rem; }
.tl-card > p { color: var(--text-muted); font-size: .88rem; margin: .25rem 0 1rem; }
.tl-copy-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; background: rgba(0,0,0,.25); border: 1px solid var(--border); border-radius: 10px; padding: .6rem .9rem; margin-bottom: .5rem; font-size: .88rem; }
.tl-ts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .5rem; }
.tl-ts-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .25rem .75rem; background: rgba(0,0,0,.25); border: 1px solid var(--border); border-radius: 10px; padding: .55rem .8rem; }
.tl-ts-preview { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-ts-meta { grid-column: 1 / -1; display: flex; gap: .6rem; align-items: baseline; font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.tl-ts-meta code { text-transform: none; letter-spacing: 0; font-size: .78rem; }
.tl-copy { font-size: .75rem; padding: .3rem .7rem; border-radius: 999px; border: 1px solid var(--border-strong); background: transparent; color: var(--text); white-space: nowrap; }
.tl-copy:hover { background: rgba(255,255,255,.08); }
.tl-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; margin-bottom: .9rem; }
@media (max-width: 640px) { .tl-fields { grid-template-columns: 1fr; } }
.tl-fields label span { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: .35rem; }
.tl-fields .te-input, .tl-fields .te-select { width: 100%; }
.tl-ts-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .9rem; font-size: .85rem; color: var(--text-muted); }
.tl-ts-bar code { color: var(--text); }
.tl-sf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .5rem; }
