/* stoneTree.css
   Arbre de passifs "vierge" (hex) + navigation via stonePassive.js

   Version sans "lumière globale" : les joints sont transparents par défaut,
   et apparaissent uniquement au survol d'une case.
*/

:root {
    --stone-hex-size: 30px;

    /* W = sqrt(3) * size, H = 2 * size */
    --stone-hex-w: calc(var(--stone-hex-size) * 1.7320508075688772);
    --stone-hex-h: calc(var(--stone-hex-size) * 2);

    /* Taille de la tuile sombre (plus GRAND = joints plus fins) */
    --stone-inner-scale: 0.925;

    /* Tuile sombre */
    --stone-tile-a: rgba(10, 12, 16, 0.98);
    --stone-tile-b: rgba(2, 3, 5, 0.98);

    /* Joints au hover (désactivés = transparents) */
    --stone-hover-ring: rgba(0, 210, 255, 0.55);
    --stone-hover-glow: rgba(0, 210, 255, 0.22);
}

/* Tab conteneur */
#passivesTab {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 420px;
}

/* UI du tree */
#stonePassiveUI {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;

    background:
        radial-gradient(900px 600px at 50% 48%, rgba(0, 120, 200, 0.08), rgba(0, 0, 0, 0) 60%),
        rgba(0, 0, 0, 0.95);

    overflow: hidden;
    font-family: "Roboto", sans-serif;
}

/* Points */
#stonePointsDisplay {
    position: absolute;
    top: 10px;
    left: 0;
    right: 0;
    text-align: center;
    text-transform: uppercase;
    color: rgba(210, 220, 235, 0.80);
    font-weight: 800;
    font-size: 2em;
    letter-spacing: 0.04em;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
    z-index: 1001;
    pointer-events: none;
}

#stonePointsDisplay.no-points {
    animation: stoneNoPoints 0.24s ease-in-out 0s 2;
}

@keyframes stoneNoPoints {
    0% { transform: translateX(0); }
    25% { transform: translateX(-30px); }
    50% { transform: translateX(30px); }
    75% { transform: translateX(-20px); }
    100% { transform: translateX(0); }
}


/* Grille (transformée via JS) */
#stonePassiveGrid {
    position: absolute;
    inset: 0;
    transform-origin: 0 0;
    transition: transform 0.15s cubic-bezier(0.25, 0.1, 0.25, 1);
    will-change: transform;
    cursor: grab;
    flex: 1;

    /* Le mix-blend ne "fuit" pas au-delà */
    isolation: isolate;
}

#stonePassiveGrid.panning {
    cursor: grabbing;
    transition: none !important;
}

/* ------------------------------------------------------------
   Hex (cases)
   ------------------------------------------------------------ */

.passive-node.stone-cell {
    position: absolute;
    width: var(--stone-hex-w);
    height: var(--stone-hex-h);

    --stone-cell-scale: 1;
    transform: translate(-50%, -50%) scale(var(--stone-cell-scale));
    transition: opacity 180ms ease, transform 180ms ease, filter 180ms ease;
    opacity: 1;

    box-sizing: border-box;

    clip-path: polygon(
        50% 0%,
        100% 25%,
        100% 75%,
        50% 100%,
        0% 75%,
        0% 25%
    );

    /* Pas de joints visibles par défaut */
    background: transparent !important;

    user-select: none;
    cursor: default;
    z-index: 2;

    /* relief neutre */
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.35);
    border: 0 !important;
    outline: 0 !important;
}

/* Cases non-débloquées : invisibles + pas d'interaction */
.passive-node.stone-cell.stone-locked {
    opacity: 0;
    --stone-cell-scale: 0.82;
    pointer-events: none;
    filter: blur(0.4px);
}

/*pour que les sockets vides “brillent” au survol*/
.passive-node.stone-cell.stone-socket.socket-empty:hover::before{
    opacity: 0.2;
    filter: drop-shadow(0 0 10px var(--stone-hover-glow));
}

/* Drop hover pendant un drag de pierre */
.passive-node.stone-cell.stone-socket.stone-socket-drop::before{
    opacity: 0.22;
    filter: drop-shadow(0 0 12px var(--stone-hover-glow));
}

.passive-node.stone-cell.stone-socket.socket-no-points.socket-empty {
    cursor: not-allowed;
}

.passive-node.stone-cell.stone-socket.socket-no-points.socket-empty::before {
    /* opacity: 0.18; */
    filter: none;
}

.passive-node.stone-cell.stone-socket.socket-no-points.socket-empty .stone-socket-plus {
    opacity: 0.25;
}


/* Anneau (joints) -> uniquement au hover */
.passive-node.stone-cell::before {
    content: "";
    position: absolute;
    inset: 0;
    clip-path: inherit;
    pointer-events: none;
    z-index: 4;

    background: var(--stone-hover-ring);
    opacity: 0;

    transition: opacity 120ms ease, filter 120ms ease;
    filter: drop-shadow(0 0 0 rgba(0, 0, 0, 0));
}

.passive-node.stone-cell:hover::before {
    opacity: 0.2;
    filter: drop-shadow(0 0 10px var(--stone-hover-glow));
}

/* Tuile sombre interne (plus grande -> joints plus fins) */
.passive-node.stone-cell::after {
    content: "";
    position: absolute;
    inset: 0;
    clip-path: inherit;
    pointer-events: none;
    z-index: 1;

    transform: scale(var(--stone-inner-scale));
    transform-origin: center;

    background:
        radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0) 55%),
        linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0.55)),
        linear-gradient(180deg, var(--stone-tile-a), var(--stone-tile-b));

    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        inset 0 -1px 0 rgba(0, 0, 0, 0.65);

    transition: filter 120ms ease, transform 120ms ease;
}

/* Feedback hover */
.passive-node.stone-cell:hover::after {
    /*filter: brightness(1.06);*/
    transform: scale(calc(var(--stone-inner-scale) - 0.003));
}

/* Bouton "Centrer" */
#centerTreeButton {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1002;
    padding: 8px 14px;
    background: rgba(20, 22, 30, 0.90);
    color: rgba(245, 250, 255, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.45);
}

#centerTreeButton:hover {
    border-color: rgba(255, 255, 255, 0.26);
}

/* Aides à gauche : ne doivent pas bloquer les interactions */
#passivesTab .controls
{
    display: flex;
    position: fixed;
    justify-content: initial;
    align-items: center;
    flex-wrap: wrap;
    flex-direction: column;
    pointer-events: none;
    z-index: 1000;
    top: 100px;
    right: 30px;
}

#passivesTab .controls img
{
    max-width: 90px;
    max-height: 99px;
}

#passivesTab .controls_action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 20px 0;
    width: 250px;
    flex-wrap: wrap;
}

/* ------------------------------------------------------------
   Inventaire des pierres (onglet Passifs)
   ------------------------------------------------------------ */

#stoneInventoryPanel{
    top: 85px;
}

.stone-inventory-panel{
    position: absolute;
    left: 18px;
    bottom: 18px;
    width: 540px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: none;
    padding: 10px 10px 12px 10px;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
    z-index: 1100;
    pointer-events: auto;
    backdrop-filter: blur(6px);
}

.stone-inventory-header{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.stone-inventory-right{
    display: flex;
    align-items: center;
    gap: 10px;
}

.stone-inventory-sort{
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: rgba(220, 235, 255, 0.75);
    user-select: none;
}

.stone-inventory-sort select{
    appearance: none;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.14);
    color: rgba(255,255,255,0.88);
    padding: 4px 10px;
    border-radius: 8px;
    font-weight: 800;
    cursor: pointer;
}

.stone-inventory-sort select:focus{
    outline: none;
    border-color: rgba(0,185,255,0.40);
    box-shadow: 0 0 0 2px rgba(0,185,255,0.20);
}

/* Onglets inventaire stones */
.stone-inv-tabs{
    margin: 8px 10px 10px;
    padding: 4px;
    border-radius: 12px;
    background: rgba(0,0,0,0.55);
    /* border: 1px solid rgba(255,255,255,0.12); */
    box-shadow: inset 0 1px rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: space-around;
}

.stone-inv-tab{
    height: 28px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.06);
    color: rgba(235,245,255,0.86);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .06em;
    cursor: pointer;
    user-select: none;
    box-shadow: inset 0 1px rgba(255,255,255,0.10);
}

.stone-inv-tab:hover{
    background: rgba(255,255,255,0.10);
    border-color: rgba(255,255,255,0.22);
}

.stone-inv-tab.active{
    background: rgba(60, 200, 255, 0.12);
    border-color: rgba(60, 200, 255, 1);
    color: rgba(255,255,255,0.95);
}

.stone-sort-wrap{
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stone-sort-label{
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .06em;
    color: rgba(220,235,255,0.72);
    padding: 0 4px;
    user-select: none;
}

.stone-sort-menu.is-inline{
    position: static;
    top: auto;
    right: auto;
    min-width: 0;
    padding: 4px;
    border-radius: 12px;
    background: rgba(0,0,0,0.55);
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow: inset 0 1px rgba(255,255,255,0.08);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    z-index: auto;
}

/* Les options deviennent des "chips" */
.stone-sort-menu.is-inline .stone-sort-option{
    width: auto;
    padding: 6px 10px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.stone-sort-menu.is-inline .stone-sort-dir{
    min-width: 12px;
    text-align: center;
}

.stone-sort-btn{
    height: 26px;
    padding: 0 10px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.06);
    color: rgba(220,235,255,0.85);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .02em;
    cursor: pointer;
    box-shadow: inset 0 1px rgba(255,255,255,0.10);
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.stone-sort-btn:hover{
    background: rgba(255,255,255,0.10);
    border-color: rgba(255,255,255,0.22);
}

.stone-sort-btn.open{
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.26);
}

.stone-sort-text{
    font-weight: 900;
    letter-spacing: .06em;
    opacity: 0.9;
}

.stone-sort-pill{
    height: 18px;
    display: inline-flex;
    align-items: center;
    padding: 0 8px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.16);
    background: rgba(2,99,138,.35);
    color: #fff;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .02em;
}

.stone-sort-arrow{
    opacity: 0.75;
    font-size: 12px;
    transition: transform .12s ease;
}

.stone-sort-btn.open .stone-sort-arrow{
    transform: rotate(180deg);
}

.stone-sort-menu{
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 160px;
    padding: 6px;
    border-radius: 12px;
    background: rgba(0,0,0,0.92);
    border: 1px solid rgba(255,255,255,0.14);
    box-shadow: 0 16px 28px rgba(0,0,0,0.55);
    z-index: 3000;
}

.stone-sort-option{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    text-align: left;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
    color: rgba(235,245,255,0.86);
    font-weight: 800;
    font-size: 12px;
    cursor: pointer;
}

.stone-sort-option:hover{
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.14);
}

.stone-sort-option.active{
    background: rgba(60, 200, 255, 0.12);
    border-color: rgba(60, 200, 255, 0.22);
}

.stone-sort-dir{
    opacity: 0.7;
    font-weight: 900;
}

.stone-inv-btn{
    width: 28px;
    height: 28px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.16);
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.85);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 1px rgba(255,255,255,0.10);
}

.stone-inv-btn:hover{
    background: rgba(255,255,255,0.10);
    border-color: rgba(255,255,255,0.22);
}

.stone-inv-btn:disabled{
    opacity: 0.35;
    cursor: default;
}

.stone-inv-btn.active{
    background: rgba(255,255,255,0.14);
    border-color: rgba(255,255,255,0.30);
}

.stone-inv-btn.danger{
    border-color: rgba(255, 80, 110, 0.30);
}
.stone-inv-btn.danger:hover{
    background: rgba(255, 80, 110, 0.10);
    border-color: rgba(255, 80, 110, 0.42);
}

/* Cadenas sur les pierres verrouillées (inventaire pierres) */
#stoneInventoryGrid .inventory-item .lock-badge{
    position: absolute;
    top: 6px;
    left: 6px;
    font-size: 14px;
    line-height: 1;
    filter: drop-shadow(0 6px 10px rgba(0,0,0,0.65));
    pointer-events: none;
    z-index: 10;
}

/* Badge T1 (debug) : point rouge en bas à gauche (inventaire des pierres uniquement) */
#stoneInventoryGrid .inventory-item{
    position: relative; /* sécurité */
}

#stoneInventoryGrid .inventory-item .t1-stars-badge{
    position: absolute;
    left: 8px;
    bottom: 8px;

    width: 12px;
    height: 12px;
    border-radius: 999px;

    background: transparent;

    z-index: 15;
    pointer-events: none;
}

#stoneInventoryGrid .inventory-item.locked{
    outline: 1px solid rgba(255,255,255,0.10);
}

.stone-inventory-title{
    font-weight: 900;
    letter-spacing: .12em;
    font-size: 12px;
    color: rgba(220, 235, 255, 0.85);
    display: flex;
    gap: 0 10px;
    align-items: center;
}

.stone-inventory-count{
    font-weight: 900;
    font-size: 16px;
    color: rgb(255 255 255);
}

.stone-inventory-count.stone-inv-full{
    animation: stoneInvCountFlash 420ms ease-out;
}

.stone-inventory-title.stone-inv-full{
    animation: stoneInvTitleShake 420ms ease-out;
    border-radius: 10px;
    padding: 4px 8px;
    background: rgba(255, 80, 80, 0.10);
    box-shadow: 0 0 18px rgba(255, 80, 80, 0.25);
}

@keyframes stoneInvCountFlash{
    0%   { transform: scale(1); color: rgba(255,255,255,1); text-shadow: none; }
    35%  { transform: scale(5); color: rgba(255,120,120,1); text-shadow: 0 0 12px rgba(255, 80, 80, 0.55); }
    100% { transform: scale(1); color: rgba(255,255,255,1); text-shadow: none; }
}

@keyframes stoneInvTitleShake{
    0%   { transform: translateX(0); }
    15%  { transform: translateX(-30px); }
    30%  { transform: translateX(30px); }
    45%  { transform: translateX(-20px); }
    60%  { transform: translateX(20px); }
    100% { transform: translateX(0); }
}

.stone-inventory-empty{
    font-size: 12px;
    color: rgba(255,255,255,0.55);
    margin-bottom: 8px;
}

.stone-inventory-grid{
    display: grid;
    grid-template-columns: repeat(5, 97px);
    grid-auto-rows: 97px;
    gap: 8px;
    justify-content: center;
    align-content: start;
    flex: 1 1 auto;      /* prend toute la hauteur restante du panel */
    min-height: 0;       /* IMPORTANT */
    max-height: none;    /* enlève le blocage */
    overflow: auto;
    padding-right: 4px;
}


.stone-inventory-grid::-webkit-scrollbar { width: 8px; }
.stone-inventory-grid::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.14);
    border-radius: 12px;
}
.stone-inventory-grid::-webkit-scrollbar-track { background: rgba(0,0,0,0.20); }


/* ------------------------------------------------------------
   Totaux des bonus (pierres socketées) - en bas à droite
   ------------------------------------------------------------ */

.stone-totals-panel{
    position: absolute;
    right: 18px;
    bottom: 30px;
    width: 380px;
    max-width: min(420px, 46vw);
    display: flex;
    flex-direction: column;
    min-height: 0;

    padding: 10px 10px 12px 10px;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.74);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
    z-index: 1100;
    pointer-events: auto;
    backdrop-filter: blur(6px);
}

.stone-totals-header{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.stone-totals-title{
    font-weight: 900;
    letter-spacing: .12em;
    font-size: 12px;
    color: rgba(220, 235, 255, 0.85);
}

.stone-totals-count{
    font-weight: 900;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.75);
}

.stone-totals-empty{
    font-size: 12px;
    color: rgba(255,255,255,0.55);
    margin-bottom: 8px;
}

.stone-totals-list{
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 0;
    max-height: 260px;
    overflow: auto;
    padding-right: 4px;
}

.stone-totals-list::-webkit-scrollbar { width: 8px; }
.stone-totals-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.14);
    border-radius: 12px;
}
.stone-totals-list::-webkit-scrollbar-track { background: rgba(0,0,0,0.20); }

.stone-total-row{
    display: flex;
    align-items: center;
    gap: 10px;

    padding: 7px 10px;
    border-radius: 12px;

    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);

    box-shadow:
        0 8px 18px rgba(0,0,0,0.22),
        inset 0 1px 0 rgba(255,255,255,0.05);
}

.stone-total-row:hover{
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.12);
}

.stone-total-icon{
    width: 18px;
    height: 18px;
    object-fit: contain;
    filter: drop-shadow(0 6px 8px rgba(0,0,0,0.55));
    opacity: 0.95;
    flex: 0 0 auto;
}

.stone-total-label{
    flex: 1 1 auto;
    min-width: 0;
    font-size: 12px;
    font-weight: 800;
    color: rgba(235, 245, 255, 0.82);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stone-total-value{
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 950;
    color: rgba(245, 250, 255, 0.92);
    text-shadow: 0 0 10px rgba(0, 210, 255, 0.18);
}

/* ------------------------------------------------------------
   Sockets stones
   ------------------------------------------------------------ */

.passive-node.stone-cell.stone-socket{
    cursor: pointer;
}

/* ------------------------------------------------------------
   Liens premium entre pierres adjacentes (6 directions)
   ------------------------------------------------------------ */

.passive-node.stone-cell.stone-socket{
    /* valeurs par défaut si JS ne les définit pas */
    --stone-link-color: rgba(0, 210, 255, 0.78);
    --stone-link-glow: rgba(0, 210, 255, 0.22);

    --stone-link-thick: calc(var(--stone-hex-size) * 0.16);
    --stone-link-len: calc(var(--stone-hex-size) * 0.98);
    --stone-link-gap: calc(var(--stone-hex-size) * 0.22);
    --stone-link-soft: calc(var(--stone-hex-size) * 0.45);
}

.stone-link-edges{
    position: absolute;
    inset: 0;
    clip-path: inherit;
    pointer-events: none;
    z-index: 2;
    mix-blend-mode: screen;
}

.stone-link-beam{
    position: absolute;
    left: 50%;
    top: 50%;
    height: var(--stone-link-thick);
    width: calc(var(--stone-link-len) - var(--stone-link-gap));
    transform-origin: 0 50%;
    border-radius: 999px;
    opacity: 0;
    filter:
        drop-shadow(0 0 6px var(--stone-link-glow))
        drop-shadow(0 0 14px color-mix(in srgb, var(--stone-link-color) 35%, transparent));
    background:
        linear-gradient(90deg,
            color-mix(in srgb, var(--stone-link-color) 0%, transparent) 0%,
            color-mix(in srgb, var(--stone-link-color) 40%, transparent) 18%,
            color-mix(in srgb, var(--stone-link-color) 85%, white 15%) 60%,
            color-mix(in srgb, var(--stone-link-color) 25%, transparent) 100%);
    transform: translateY(-50%) rotate(var(--stone-link-rot, 0deg)) translateX(var(--stone-link-gap));
    transition: opacity 140ms ease, filter 140ms ease;
}

.stone-link-beam::before{
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    opacity: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
    transform: translateX(-70%);
    filter: blur(0.5px);
}

.stone-link-beam::after{
    content: "";
    position: absolute;
    right: -2px;
    top: 50%;
    width: calc(var(--stone-link-thick) * 2.2);
    height: calc(var(--stone-link-thick) * 2.2);
    transform: translateY(-50%);
    border-radius: 999px;
    opacity: 0;
    background: radial-gradient(circle,
        color-mix(in srgb, var(--stone-link-color) 78%, white 22%) 0%,
        color-mix(in srgb, var(--stone-link-color) 35%, transparent) 45%,
        rgba(0,0,0,0) 70%);
    filter: blur(0.2px);
}

.stone-link-beam.is-on{
    opacity: 0.86;
}

.passive-node.stone-cell.has-stone-links .stone-link-beam.is-on{
    opacity: 0.96;
}

.stone-link-beam.is-on::before{
    opacity: 0.55;
    animation: stoneLinkSweep 2200ms ease-in-out infinite;
}

.stone-link-beam.is-on::after{
    opacity: 0.92;
    animation: stoneLinkPulse 1600ms ease-in-out infinite;
}

/* Alignement des 6 directions (pointy-top) */
.stone-link-beam.d0{ --stone-link-rot: 0deg; }
.stone-link-beam.d1{ --stone-link-rot: -60deg; }
.stone-link-beam.d2{ --stone-link-rot: -120deg; }
.stone-link-beam.d3{ --stone-link-rot: 180deg; }
.stone-link-beam.d4{ --stone-link-rot: 120deg; }
.stone-link-beam.d5{ --stone-link-rot: 60deg; }

@keyframes stoneLinkSweep{
    0%   { transform: translateX(-70%); opacity: 0; }
    10%  { opacity: 0.45; }
    50%  { transform: translateX(40%); opacity: 0.75; }
    90%  { opacity: 0.35; }
    100% { transform: translateX(120%); opacity: 0; }
}

@keyframes stoneLinkPulse{
    0%, 100% { transform: translateY(-50%) scale(0.92); filter: blur(0.2px); }
    45%      { transform: translateY(-50%) scale(1.05); filter: blur(0.0px); }
}

.stone-socket-content{
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 3;
}

.stone-socket-img{
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 8px 10px rgba(0,0,0,0.55));
}

.stone-socket-plus{
    font-weight: 900;
    font-size: 18px;
    color: rgba(255,255,255,0.40);
    text-shadow: 0 6px 12px rgba(0,0,0,0.60);
}


/* ============================================================
   StoneCard tooltip (premium)
   ============================================================ */

.stone-tooltip {
    position: fixed;
    left: 0;
    top: 0;
    min-width: 600px;
    max-width: min(720px, 92vw);
    z-index: 6000;
    pointer-events: none;

    opacity: 0;
    transform: translateY(8px) scale(0.985);
    transition: opacity 90ms ease, transform 90ms ease;

    --sc-accent: rgba(0, 210, 255, 0.9);
    --sc-bg-a: rgba(6, 10, 14, 0.88);
    --sc-bg-b: rgba(1, 4, 7, 0.78);
}

.stone-tooltip.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.stone-dragging .stone-tooltip {
    opacity: 0 !important;
    transform: translateY(8px) scale(0.985) !important;
}

.stone-tooltip .sc-card {
    position: relative;
    border-radius: 16px;
    overflow: hidden;

    background:
        radial-gradient(900px 260px at 20% 0%, rgba(255,255,255,0.10), rgba(255,255,255,0) 55%),
        radial-gradient(700px 280px at 110% 40%, rgba(255,255,255,0.06), rgba(255,255,255,0) 60%),
        linear-gradient(180deg, var(--sc-bg-a), var(--sc-bg-b));

    border: 1px solid rgba(255,255,255,0.14);
    box-shadow:
        0 20px 55px rgba(0,0,0,0.70),
        0 0 0 1px rgba(0,0,0,0.35) inset;
    backdrop-filter: blur(10px);
}

.stone-tooltip .sc-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 16px;
    pointer-events: none;

    box-shadow:
        0 0 0 1px rgba(255,255,255,0.06) inset,
        0 0 22px rgba(0,0,0,0.45) inset;
}

.stone-tooltip .sc-accent {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.85;

    background:
        radial-gradient(280px 160px at 18% 8%, color-mix(in srgb, var(--sc-accent) 35%, transparent), transparent 70%),
        radial-gradient(280px 180px at 110% 30%, color-mix(in srgb, var(--sc-accent) 20%, transparent), transparent 70%);
}

.stone-tooltip .sc-top {
    display: flex;
    gap: 12px;
    padding: 14px 14px 10px 14px;
    align-items: center;
}

.stone-tooltip .sc-ico {
    width: 96px;
    height: 96px;
    border-radius: 14px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.14);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;

    box-shadow:
        inset 0 0 10px rgba(255,255,255,0.06),
        0 10px 18px rgba(0,0,0,0.40);
}

.stone-tooltip .sc-ico img {
    width: 78%;
    height: 78%;
    object-fit: contain;
    filter: drop-shadow(0 8px 10px rgba(0,0,0,0.55));
}

.stone-tooltip .sc-title-wrap {
    flex: 1 1 auto;
    min-width: 0;
}

.stone-tooltip .sc-name {
    font-weight: 950;
    letter-spacing: 0.05em;
    font-size: 20px;
    color: rgba(245, 250, 255, 0.92);
    white-space: normal;
    overflow: visible;
    text-overflow: clip;

    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;     /* évite un tooltip énorme */
    line-height: 1.15;
}

.stone-tooltip .sc-meta {
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.stone-tooltip .sc-rarity {
    font-weight: 950;
    font-size: 18px;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    color: var(--sc-accent);
    text-shadow: 0 0 10px color-mix(in srgb, var(--sc-accent) 35%, transparent);
}

.stone-tooltip .sc-level {
    font-size: 13px;
    color: rgba(255,255,255,0.62);
}

.stone-tooltip .sc-divider {
    height: 1px;
    margin: 0 14px;
    background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,0.12), rgba(255,255,255,0));
}

.stone-tooltip .sc-body {
    padding: 12px 14px 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Hint ALT : afficher la valeur de base (uniquement si applicable) */
.stone-tooltip .sc-foot{
    padding: 0 14px 14px 14px;
    display: flex;
    justify-content: flex-end;
}

.stone-tooltip .sc-alt-hint{
    display: inline-flex;
    align-items: center;
    gap: 0;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;

    color: rgba(235, 245, 255, 0.62);

    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 999px;
    padding: 6px 10px;
}

.stone-tooltip .sc-alt-hint .sc-key{
    display: inline-flex;
    align-items: center;
    justify-content: center;

    height: 18px;
    padding: 0 7px;
    margin-right: 8px;

    border-radius: 7px;
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.12);

    color: rgba(255,255,255,0.85);
    font-weight: 950;
    font-size: 11px;
    letter-spacing: 0.08em;
}

.stone-tooltip .sc-row {
    display: grid;
    grid-template-columns: 1fr max-content;
    gap: 12px;
    align-items: center;

    padding: 18px 22px;
    border-radius: 14px;

    background:
        radial-gradient(120% 140% at 50% 0%, color-mix(in srgb, var(--sc-accent) 18%, transparent), transparent 60%),
        linear-gradient(90deg, rgba(255,255,255,0.08), rgba(255,255,255,0) 45%),
        rgba(0,0,0,0.28);

    border: 1px solid rgba(255,255,255,0.10);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.35);
}

.stone-tooltip .sc-stat-label {
    font-weight: 800;
    font-size: 25px;
    letter-spacing: 0.04em;
    color: rgba(235, 245, 255, 0.86);

    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stone-tooltip .sc-stat-value {
    font-weight: 950;
    color: rgba(255,255,255,0.95);
    font-size: 25px;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.15;
    font-variant-numeric: tabular-nums; /* chiffres bien alignés */
}

/* Valeur "effective" (boost/polish appliqué) : mettre en vert */
.stone-tooltip.sc-effective .sc-stat-label,
.stone-tooltip.sc-effective .sc-stat-value{
    color: rgba(0, 255, 120, 0.92);
    text-shadow: 0 0 10px rgba(0, 255, 120, 0.22);
}


.stone-tooltip .sc-left{
    min-width: 0;
}

.stone-tooltip .sc-row.has-desc{
    align-items: flex-start;
}

.stone-tooltip .sc-stat-desc{
    margin-top: 6px;
    font-size: 13px;
    color: rgba(235, 245, 255, 0.70);
    line-height: 1.25;
    max-width: 520px;
}


.stone-tooltip .sc-stat-head{
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
}

.stone-tooltip .sc-stat-icon{
    width: 22px;
    height: 22px;
    object-fit: contain;
    filter: drop-shadow(0 6px 8px rgba(0,0,0,0.45));
    opacity: 0.95;
}

.stone-tooltip .sc-tier{
    margin-top: 6px;
}

.stone-tooltip .sc-tier-pill{
    display: inline-flex;
    align-items: center;
    height: 18px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 950;
    letter-spacing: 0.08em;

    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.72);
}
.stone-tooltip .sc-badges{
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Badge de tier style "objet" + jauge de roll */
.stone-tooltip .sc-tier-badge{
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;

    padding: 6px 10px 6px 10px;
    border-radius: 12px;
    min-width: 60px;

    background:
        radial-gradient(120% 140% at 50% 0%, color-mix(in srgb, currentColor 14%, transparent), transparent 65%),
        rgba(255,255,255,0.06);

    border: 1px solid rgba(255,255,255,0.14);
    color: rgba(255,255,255,0.82);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.35);
    line-height: 1;
    box-sizing: border-box;
}

.stone-tooltip .sc-tier-text{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;

    font-size: 14px;
    font-weight: 950;
    letter-spacing: 0.10em;
    white-space: nowrap;
}

.stone-tooltip .sc-tier-star{
    font-size: 12px;
    color: rgba(255,255,255,0.92);
    text-shadow: 0 0 10px rgba(255, 220, 140, 0.55);
    transform: translateY(-0.5px);
}

.stone-tooltip .sc-tier-meter{
    width: 46px;
    height: 4px;
    border-radius: 999px;
    background: rgba(255,255,255,0.12);
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.10);
}

.stone-tooltip .sc-tier-meter-fill{
    display: block;
    height: 100%;
    width: 0%;
    background: currentColor; /* reprend la couleur du tier */
}

/* T10 gris (comme objets) */
.stone-tooltip .sc-tier-badge.t10{
    background:
        radial-gradient(120% 140% at 50% 0%, rgba(255,255,255,0.10), transparent 70%),
        rgba(180, 180, 180, 0.10);
    border-color: rgba(210, 210, 210, 0.22);
    color: rgba(235, 235, 235, 0.85);
}

/* T1 doré */
.stone-tooltip .sc-tier-badge.t1{
    background:
        radial-gradient(120% 140% at 50% 0%, rgba(255, 210, 100, 0.22), transparent 60%),
        linear-gradient(180deg, rgba(255, 196, 70, 0.34), rgba(95, 55, 0, 0.22));
    border-color: rgba(255, 210, 100, 0.45);
    color: rgba(255, 230, 170, 0.95);
    box-shadow:
        inset 0 0 12px rgba(0,0,0,0.25),
        0 0 16px rgba(255, 190, 70, 0.14);
}

/* Etoiles blanches "T1" (uniquement si ★x2, ★x3, etc) */
.stone-tooltip .sc-t1-stars{
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 10px;
    border-radius: 999px;

    font-size: 11px;
    font-weight: 950;
    letter-spacing: 0.10em;

    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.14);
    color: rgba(255,255,255,0.92);
    text-shadow: 0 0 10px rgba(255,255,255,0.20);
}

/* ============================================================
   Icône centrale (inventaire pierres)
   ============================================================ */

#stoneInventoryGrid .inventory-item .stone-inv-icon{
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -52%);
    width: 50%!important;
    height: 50%!important;
    object-fit: contain;
    pointer-events: none;
    z-index: 5;
    filter: drop-shadow(0 6px 10px rgba(0,0,0,0.55));
}
/* Inventaire des pierres : agrandir l'image dans la case */
.stone-inventory-grid .inventory-slot img {
    width: 100%!important;
    height: 100%!important;
    object-fit: contain;
}


/* ============================================================
   Icône + étoile (socket)
   ============================================================ */

.stone-socket-icon{
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -52%);
    width: 50%;
    height: 50%;
    object-fit: contain;
    pointer-events: none;
    z-index: 5;
    filter: drop-shadow(0 6px 10px rgba(0,0,0,0.55));
}

.stone-inventory-grid .inventory-slot.stone-inv-drop{
    outline: 2px solid rgba(255,255,255,0.16);
    outline-offset: -2px;
    background: rgba(255,255,255,0.05);

    box-shadow:
        inset 0 0 0 2px rgba(0, 210, 255, 0.14),
        0 0 12px rgba(0, 210, 255, 0.10);
}

/* ------------------------------------------------------------
   Barre d’actions (style inventaire) pour l’inventaire de pierres
   ------------------------------------------------------------ */

#passivesTab .interaction-hint.stone-interaction-hint{
    z-index: 2500; /* au-dessus des panels */
}

/* On affiche la barre uniquement si une pierre est sélectionnée */
#passivesTab:has(#stoneInventoryGrid .selected-item) .interaction-hint.stone-interaction-hint{
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* (Optionnel mais recommandé) : on remonte les panneaux quand la barre est visible */
#passivesTab:has(#stoneInventoryGrid .selected-item) #stoneInventoryPanel{
    bottom: 78px !important;
}
#passivesTab:has(#stoneInventoryGrid .selected-item) .stone-totals-panel{
    bottom: 78px !important;
}


/******** TEST ANTI CRASH******/
.stone-dragging .stone-socket-img,
.stone-dragging .inventory-item,
.stone-dragging .inventory-item img,
.stone-dragging .stone-tooltip .sc-card {
    filter: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
}
/******************************/
