/* ============================================================
 * Forge - panel "Forge"
 * Disposition : bandeau forge horizontal (canvas + etat cote a cote)
 *               puis toolbar d'onglets, puis grille plein largeur.
 * ============================================================ */

.panel-forge {
    padding: 20px 24px 28px;
}

/* ============================================================
 * Upgrade bar (construction / amelioration Forge, T0..T5)
 * Bandeau horizontal sous le subtitle, avant le layout.
 * ============================================================ */
.forge-upgrade-bar {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 14px 18px;
    background:
        radial-gradient(ellipse at 0% 50%, rgba(255, 140, 40, 0.08), transparent 70%),
        linear-gradient(180deg, rgba(var(--bg-card-rgb, 20, 18, 30), 0.92) 0%, rgba(var(--bg-card-rgb, 20, 18, 30), 0.7) 100%);
    border: 1px solid rgba(var(--gold-rgb), 0.25);
    border-radius: 14px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
/* Conteneur externe vide (T1+) : prend zero place, le bandeau est dans le catalog. */
.forge-upgrade-bar:empty {
    display: none;
}
/* Bandeau inline dans .forge-catalog : meme style que .forge-upgrade-bar
   (double classe), mais limite a la colonne catalog (pas plein largeur). */
.forge-upgrade-inline-bar:empty {
    display: none;
}
/* Variant T0 : construction -- pas un bandeau, plutot une carte centree. */
.forge-upgrade-bar-init {
    background: none;
    border: none;
    box-shadow: none;
    padding: 0;
}
.forge-build-card {
    max-width: 520px;
    margin: 40px auto;
    padding: 32px 28px;
    text-align: center;
    border: 2px solid rgba(255, 140, 40, 0.5);
    background:
        radial-gradient(ellipse at 50% 0%, rgba(255, 140, 40, 0.18), transparent 65%),
        linear-gradient(135deg, rgba(var(--gold-rgb), 0.08), rgba(20, 12, 8, 0.85));
    border-radius: 14px;
    box-shadow:
        0 0 48px rgba(255, 120, 30, 0.12),
        0 6px 22px rgba(0, 0, 0, 0.5);
}
.forge-build-title {
    font-family: 'Cinzel', serif;
    color: var(--gold);
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 10px;
    text-shadow: 0 0 14px rgba(var(--gold-rgb), 0.35);
}
.forge-build-desc {
    opacity: 0.88;
    margin-bottom: 20px;
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 0.95rem;
    line-height: 1.5;
}
.forge-build-desc strong {
    color: var(--gold-light, #ffd97a);
}
.forge-build-cost {
    font-family: 'Oswald', sans-serif;
    margin-bottom: 20px;
    font-size: 1.1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
}
.forge-build-cost .inline-icon {
    width: 22px;
    height: 22px;
    image-rendering: pixelated;
    vertical-align: middle;
    filter: drop-shadow(0 0 4px rgba(var(--gold-rgb), 0.45));
}
/* Bouton dans la build-card : plein largeur contenu, empile sous le cout. */
.forge-build-card .forge-btn-craft {
    flex: none;
    display: inline-block;
    margin: 0 auto;
}
.forge-upgrade-bar-max {
    border-color: rgba(var(--rarity-primordial-rgb), 0.5);
    background:
        radial-gradient(ellipse at 50% 50%, rgba(var(--rarity-primordial-rgb), 0.12), transparent 70%),
        linear-gradient(180deg, rgba(var(--bg-card-rgb, 20, 18, 30), 0.92) 0%, rgba(var(--bg-card-rgb, 20, 18, 30), 0.7) 100%);
}
.forge-upgrade-info {
    flex: 1 1 auto;
    min-width: 0;
}
.forge-upgrade-title {
    font-family: 'Cinzel', serif;
    font-size: 1.02rem;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: 0.5px;
    text-shadow: 0 0 10px rgba(var(--gold-rgb), 0.3);
    margin: 0;
}
.forge-upgrade-desc {
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 0.88rem;
    color: var(--text-main);
    margin-top: 3px;
    opacity: 0.88;
}
.forge-upgrade-desc strong {
    color: var(--gold-light, #ffd97a);
}
.forge-upgrade-action {
    flex: 0 0 auto;
    min-width: 240px;
    text-align: center;
}
/* Override necessaire : .forge-btn-craft definit `flex: 1 1 auto` plus bas
   dans le CSS, ce qui fait s'etirer le bouton dans le bandeau. On force le
   shrink-to-content pour correspondre au bouton alchimie. */
.forge-btn-craft.forge-upgrade-action {
    flex: 0 0 auto;
    padding: 13px 30px;
}

/* Rarete verrouillee dans la modale detail (tier > forge_tier) */
.forge-rarity-btn.is-locked {
    opacity: 0.55;
    cursor: not-allowed;
    filter: saturate(0.4);
}
.forge-rarity-btn.is-locked::after {
    content: '🔒';
    position: absolute;
    top: 3px;
    right: 4px;
    font-size: 10px;
    opacity: 0.9;
}
.forge-modal-notice.is-tier-locked {
    background: rgba(170, 68, 255, 0.12);
    border-color: rgba(170, 68, 255, 0.4);
    color: var(--forge-accent-light);
}

.forge-header {
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(var(--gold-rgb), 0.18);
    position: relative;
}

.forge-header::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 90px;
    height: 2px;
    background: linear-gradient(90deg, var(--gold), transparent);
}

.forge-subtitle {
    margin-top: 8px;
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-family: 'Roboto Condensed', sans-serif;
    letter-spacing: 0.2px;
}

/* Le panel-fabrication est en flex column height:100% (alchemy.css). On
   propage la hauteur : ftab-forge -> forge-layout -> forge-catalog -> forge-grid
   pour que la grille pagine en fonction de l'espace dispo (miroir Banque). */
#ftab-forge.fabrication-tab-content.active {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.forge-layout {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 26px;
    align-items: stretch;
    flex: 1;
    min-height: 0;
}

@media (max-width: 980px) {
    .forge-layout {
        grid-template-columns: 1fr;
        /* Mobile : on rend la main au scroll naturel de game-main. La pagination
           degenere en 1 page (toutes les cards visibles) car clientHeight n'est
           plus contraint - acceptable sur petit ecran. */
        flex: none;
        min-height: auto;
    }
    .forge-grid {
        /* On annule le clip vertical : la grille suit son contenu et le
           scroll est gere par game-main. */
        flex: none;
        overflow: visible;
    }
    /* Stage sticky desactive en colonne unique : sinon il occupe toute la
       hauteur du viewport pendant qu'on parcourt les recettes en dessous. */
    .forge-stage {
        position: static;
        min-height: 360px;
    }
}

/* Mobile / tablette : adoucir paddings, autoriser le wrap des bandeaux,
   permettre le scroll horizontal des onglets nombreux (Gants/Bottes/...). */
@media (max-width: 1000px) {
    .panel-forge { padding: 14px 12px 20px; }
    .forge-upgrade-bar {
        flex-wrap: wrap;
        gap: 12px;
        padding: 12px 14px;
    }
    .forge-upgrade-action {
        min-width: 0;
        width: 100%;
    }
    .forge-btn-craft.forge-upgrade-action { width: 100%; }
    .forge-slot-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        scrollbar-width: none;
    }
    .forge-slot-tabs::-webkit-scrollbar { display: none; }
    .forge-slot-tab {
        flex-shrink: 0;
        padding: 8px 14px;
        font-size: 0.85rem;
    }
}

/* ============================================================
 * Stage (autel vertical, sticky)
 * ============================================================ */

/* Bouton icone "upgrade" en haut-gauche de la forge-stage. Remplace le
   bandeau horizontal `.forge-upgrade-inline-bar` (refonte UX 2026-05-14).
   Hover : leve + glow. Disabled (pas assez de cendres) : grise. Tooltip
   natif (title) affiche le detail tier/cout au survol. */
.forge-upgrade-icon {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(var(--gold-rgb), 0.25), rgba(var(--gold-rgb), 0.08));
    border: 1px solid var(--gold);
    border-radius: 50%;
    color: var(--gold);
    cursor: pointer;
    z-index: 5;
    box-shadow: 0 0 10px rgba(var(--gold-rgb), 0.35);
    transition: transform 0.15s, filter 0.15s, box-shadow 0.15s, opacity 0.15s;
}
.forge-upgrade-icon:hover:not(:disabled) {
    transform: translateY(-1px);
    filter: brightness(1.2);
    box-shadow: 0 0 14px rgba(var(--gold-rgb), 0.6);
}
.forge-upgrade-icon:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    box-shadow: none;
}
/* Etat "cendres insuffisantes" : bouton toujours cliquable (la modale
   affichera le message), mais visuellement attenue pour signaler que
   l'upgrade n'est pas immediate. */
.forge-upgrade-icon-locked {
    opacity: 0.55;
    filter: grayscale(0.3);
}
.forge-upgrade-icon-locked:hover:not(:disabled) {
    opacity: 0.85;
    filter: none;
}
.forge-upgrade-icon > svg {
    width: 16px;
    height: 16px;
    display: block;
}

.forge-stage {
    /* align-self: start dans le grid .forge-layout (qui est en align-items:
       stretch + flex:1). Sans ça, le stage est étiré sur toute la hauteur
       restante et déborde visuellement vers le bas. Avec start, il garde
       sa hauteur naturelle (min-height: 480px) et libère du clientHeight
       pour le grid catalog → la pagination calcule correctement les rows. */
    align-self: start;
    position: sticky;
    top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    background:
        radial-gradient(circle at 50% 38%, rgba(255, 140, 40, 0.22) 0%, transparent 55%),
        radial-gradient(circle at 50% 92%, rgba(var(--gold-rgb), 0.25), transparent 60%),
        linear-gradient(180deg, rgba(20, 12, 8, 0.85), rgba(10, 6, 4, 0.95));
    border: 1px solid rgba(var(--gold-rgb), 0.35);
    border-radius: 18px;
    padding: 18px 20px 22px;
    min-height: 480px;
    box-shadow:
        0 0 0 1px rgba(var(--gold-rgb), 0.12) inset,
        0 0 42px rgba(255, 110, 30, 0.08) inset,
        0 14px 36px rgba(0, 0, 0, 0.55);
    overflow: hidden;
}

.forge-stage::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 70%, rgba(255, 140, 40, 0.14), transparent 60%);
    pointer-events: none;
    animation: forge-breath 4s ease-in-out infinite;
}

.forge-stage::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 72%;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(var(--gold-rgb), 0.7), transparent);
}

@keyframes forge-breath {
    0%, 100% { opacity: 0.85; }
    50%      { opacity: 1; }
}

.forge-canvas-frame {
    position: relative;
    display: inline-flex;
    align-items: flex-end;
    justify-content: center;
    padding: 6px 10px 0;
}

.forge-anvil-glow {
    position: absolute;
    left: 50%;
    bottom: -4px;
    transform: translateX(-50%);
    width: 80%;
    height: 22px;
    background:
        radial-gradient(ellipse at center, rgba(255, 140, 40, 0.55), rgba(255, 80, 20, 0.15) 55%, transparent 75%);
    filter: blur(3px);
    pointer-events: none;
    animation: forge-anvil-pulse 2.6s ease-in-out infinite;
}

@keyframes forge-anvil-pulse {
    0%, 100% { opacity: 0.7; transform: translateX(-50%) scaleX(1); }
    50%      { opacity: 1;   transform: translateX(-50%) scaleX(1.08); }
}

.forge-canvas {
    width: 288px;
    height: 288px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    display: block;
    filter:
        drop-shadow(0 6px 14px rgba(0, 0, 0, 0.75))
        drop-shadow(0 0 22px rgba(255, 120, 30, 0.25));
    position: relative;
    z-index: 1;
}

.forge-stage-title {
    position: relative;
    z-index: 3;
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--gold);
    text-shadow: 0 0 10px rgba(var(--gold-rgb), 0.4);
    margin: 0 0 12px;
    opacity: 0.95;
}

.forge-stage-inner {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    width: 100%;
}

.forge-stage-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    width: 100%;
    padding-top: 4px;
}

.forge-state-label {
    font-family: 'Cinzel', serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    text-shadow: 0 0 12px rgba(var(--gold-rgb), 0.35);
}

.forge-state-recipe {
    font-size: 0.86rem;
    color: var(--text-main);
    font-family: 'Roboto Condensed', sans-serif;
    min-height: 1.2em;
    max-width: 280px;
    opacity: 0.9;
}

.forge-countdown {
    font-family: 'Oswald', sans-serif;
    font-size: 1.85rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 4px;
    padding: 8px 22px;
    border-radius: 10px;
    background:
        linear-gradient(180deg, rgba(var(--gold-rgb), 0.18), rgba(var(--gold-rgb), 0.06));
    border: 1px solid rgba(var(--gold-rgb), 0.45);
    box-shadow:
        0 0 18px rgba(var(--gold-rgb), 0.2) inset,
        0 4px 12px rgba(0, 0, 0, 0.4);
    text-shadow: 0 0 8px rgba(var(--gold-rgb), 0.5);
}

.forge-collect-btn {
    margin-top: 4px;
    animation: forge-pulse 1.4s ease-in-out infinite;
    letter-spacing: 1px;
}

.forge-cancel-hint {
    opacity: 0.7;
    cursor: default;
    font-size: 0.78rem;
    letter-spacing: 0.5px;
}

@keyframes forge-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 100, 30, 0.5), 0 0 18px rgba(255, 90, 30, 0.2); }
    50%      { box-shadow: 0 0 18px 4px rgba(255, 100, 30, 0.35), 0 0 28px rgba(255, 90, 30, 0.45); }
}

/* ============================================================
 * Braises flottantes
 * ============================================================ */

.forge-stage-embers {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.forge-stage-embers .ember {
    position: absolute;
    bottom: -6px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 180, 80, 0.95), rgba(255, 110, 30, 0.4) 60%, transparent 80%);
    box-shadow: 0 0 6px rgba(255, 140, 40, 0.7);
    opacity: 0;
    animation: forge-ember 5.5s linear infinite;
}

.forge-stage-embers .ember-1 { left: 18%; animation-delay: 0s;   animation-duration: 5.5s; }
.forge-stage-embers .ember-2 { left: 32%; animation-delay: 1.3s; animation-duration: 6.2s; }
.forge-stage-embers .ember-3 { left: 48%; animation-delay: 2.6s; animation-duration: 5.0s; }
.forge-stage-embers .ember-4 { left: 62%; animation-delay: 0.9s; animation-duration: 6.8s; }
.forge-stage-embers .ember-5 { left: 75%; animation-delay: 3.4s; animation-duration: 5.8s; }
.forge-stage-embers .ember-6 { left: 88%; animation-delay: 4.1s; animation-duration: 6.4s; }

@keyframes forge-ember {
    0%   { opacity: 0;   transform: translateY(0) translateX(0) scale(0.6); }
    15%  { opacity: 1; }
    80%  { opacity: 0.6; }
    100% { opacity: 0;   transform: translateY(-380px) translateX(12px) scale(1.2); }
}

/* ============================================================
 * Etat "forge eteinte" (is-idle) : moins d'orange, plus froid
 * ============================================================ */

.forge-stage.is-idle {
    background:
        radial-gradient(circle at 50% 38%, rgba(120, 110, 130, 0.12) 0%, transparent 55%),
        radial-gradient(circle at 50% 92%, rgba(var(--gold-rgb), 0.1), transparent 60%),
        linear-gradient(180deg, rgba(14, 12, 18, 0.9), rgba(8, 6, 10, 0.96));
    border-color: rgba(var(--gold-rgb), 0.18);
    box-shadow:
        0 0 0 1px rgba(var(--gold-rgb), 0.06) inset,
        0 0 32px rgba(0, 0, 0, 0.35) inset,
        0 14px 36px rgba(0, 0, 0, 0.55);
}

.forge-stage.is-idle::before {
    background: radial-gradient(ellipse at 50% 70%, rgba(130, 120, 140, 0.06), transparent 60%);
    animation: none;
    opacity: 0.6;
}

.forge-stage.is-idle::after {
    background: linear-gradient(90deg, transparent, rgba(var(--gold-rgb), 0.28), transparent);
}

.forge-stage.is-idle .forge-canvas {
    filter:
        drop-shadow(0 6px 14px rgba(0, 0, 0, 0.75))
        grayscale(0.5)
        brightness(0.75);
}

.forge-stage.is-idle .forge-anvil-glow {
    background: radial-gradient(ellipse at center, rgba(120, 110, 130, 0.18), rgba(80, 70, 90, 0.06) 55%, transparent 75%);
    animation: none;
    opacity: 0.35;
}

.forge-stage.is-idle .forge-stage-title {
    color: rgba(var(--gold-rgb), 0.45);
    text-shadow: none;
}

.forge-stage.is-idle .forge-state-label {
    color: rgba(var(--gold-rgb), 0.55);
    text-shadow: none;
}

.forge-stage.is-idle .forge-state-recipe {
    opacity: 0.65;
}

.forge-stage.is-idle .forge-stage-embers .ember {
    background: radial-gradient(circle, rgba(150, 140, 160, 0.35), rgba(100, 90, 110, 0.15) 60%, transparent 80%);
    box-shadow: 0 0 3px rgba(120, 110, 130, 0.25);
    animation-duration: 9s;
    opacity: 0.35 !important;
}

/* ============================================================
 * Sidebar icon
 * ============================================================ */

.forge-sidebar-icon {
    display: inline-block;
    background-image: url('/assets/image/Icon/Fabrication/Forge.webp');
    background-repeat: no-repeat;
    background-size: 500% 400%;
    background-position: 0% 0%;   /* Frame 0 (col 0, row 0) - forge froide */
    image-rendering: pixelated;
}

.forge-sidebar-icon.is-crafting {
    background-position: 0% 100%; /* Frame 15 (col 0, row 3) - forge allumee */
}

.forge-sidebar-icon.is-ready {
    background-position: 0% 100%; /* Meme frame + glow pulsant */
    filter: drop-shadow(0 0 6px rgba(var(--gold-rgb), 0.7));
    animation: forge-icon-glow 1.6s ease-in-out infinite;
}

@keyframes forge-icon-glow {
    0%, 100% { filter: drop-shadow(0 0 4px rgba(var(--gold-rgb), 0.4)); }
    50%      { filter: drop-shadow(0 0 10px rgba(var(--gold-rgb), 0.9)); }
}

/* ============================================================
 * Catalog (colonne droite)
 * ============================================================ */

.forge-catalog {
    display: flex;
    flex-direction: column;
    gap: 14px;
    /* Hauteur heritee de la cellule grid (.forge-layout en flex: 1).
       min-height: 0 permet aux enfants flex (.forge-grid) de se contraindre. */
    min-height: 0;
}

/* Header catalog : miroir de .alchemy-catalog-header (grid 1fr | 260px).
   La colonne 260px est reservee a un eventuel display complementaire ; pour
   l'instant le bandeau upgrade occupe uniquement la colonne 1fr, ce qui le
   rend plus compact que s'il prenait toute la largeur. */
.forge-catalog-header {
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: 14px;
    align-items: stretch;
}
@media (max-width: 600px) {
    /* Mobile : cards plus petites (160px) pour avoir plus de cols sur petit
       ecran. Le JS recalcule cols × rows automatiquement. */
    .forge-grid { grid-template-columns: repeat(auto-fill, 160px); grid-auto-rows: 120px; gap: 10px; }
    .forge-stage { min-height: 300px; padding: 14px 12px 18px; }
    .forge-upgrade-title { font-size: 0.95rem; }
    .forge-upgrade-desc { font-size: 0.82rem; }
}

@media (max-width: 720px) {
    .forge-catalog-header { grid-template-columns: 1fr; }
}

/* Onglets de type (Gants / Bottes / Harpons) : style sobre miroir de
   .alchemy-subtab - transparent + soulignement accent a l'actif. */
.forge-slot-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid rgba(255, 120, 40, 0.22);
    margin-bottom: 8px;
}

.forge-slot-tab {
    padding: 9px 18px;
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    letter-spacing: 0.4px;
    transition: color 0.2s, border-color 0.2s;
}
.forge-slot-tab:hover:not(.active) { color: #ffc299; }
.forge-slot-tab.active {
    color: #ffd9be;
    border-bottom-color: #ff7c30;
    text-shadow: 0 0 8px rgba(255, 120, 50, 0.35);
}

.forge-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding: 4px 0 2px;
}

.forge-tab {
    padding: 7px 15px;
    background: rgba(var(--bg-card-rgb, 20, 18, 30), 0.55);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    color: var(--text-secondary);
    font-family: 'Cinzel', serif;
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.6px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-transform: uppercase;
}

.forge-tab:hover {
    border-color: rgba(var(--gold-rgb), 0.5);
    color: var(--text-main);
    transform: translateY(-1px);
}

.forge-tab.active {
    color: var(--forge-bg-deep);
    background: var(--gold);
    border-color: var(--gold);
    box-shadow: 0 2px 10px rgba(var(--gold-rgb), 0.35);
}

.forge-tab[data-tier-key="fragile"].active        { background: var(--rarity-fragile); border-color: var(--rarity-fragile); color: var(--forge-bg-deep); box-shadow: 0 2px 12px rgba(154, 160, 166, 0.45); }
.forge-tab[data-tier-key="robuste"].active        { background: var(--rarity-robuste); border-color: var(--rarity-robuste); color: #ffffff; box-shadow: 0 2px 12px rgba(68, 136, 255, 0.45); }
.forge-tab[data-tier-key="alpha"].active          { background: var(--rarity-alpha); border-color: var(--rarity-alpha); color: #ffffff; box-shadow: 0 2px 12px rgba(170, 68, 255, 0.45); }
.forge-tab[data-tier-key="ancien"].active         { background: var(--rarity-ancien); border-color: var(--rarity-ancien); color: #ffffff; box-shadow: 0 2px 12px rgba(255, 34, 68, 0.45); }
.forge-tab[data-tier-key="primordial"].active     { background: var(--rarity-primordial); border-color: var(--rarity-primordial); color: var(--forge-bg-deep); box-shadow: 0 2px 14px rgba(255, 136, 0, 0.55); }
.forge-tab[data-tier-key="primordial_pur"].active { background: var(--rarity-primordial_pur); border-color: var(--rarity-primordial_pur); color: var(--forge-bg-deep); box-shadow: 0 2px 16px rgba(34, 211, 238, 0.6); }

/* ============================================================
 * Grille plein largeur
 * ============================================================ */

.forge-grid {
    display: grid;
    /* Auto-fill avec cards a largeur fixe (200px) : le navigateur calcule
       le nombre de colonnes qui rentrent, le JS (forge.js) calcule en miroir
       cols × rows pour adapter PAGE_SIZE. Mirror du pattern Banque
       (.inv-grid) et Sanctuaire (.sanctuary-grid). */
    grid-template-columns: repeat(auto-fill, 200px);
    grid-auto-rows: 135px;
    justify-content: center;
    align-content: start;
    gap: 14px;
    /* Cap a 5 colonnes (5×200 + 4×14 = 1056px) : sur grand ecran, la grille
       se centre et reste a 5 cols max. Sur ecran etroit, auto-fill reduit
       naturellement le nb de cols. */
    max-width: 1056px;
    width: 100%;
    margin: 0 auto;
    /* flex:1 + min-height:0 + overflow:hidden : le grid prend toute la
       hauteur restante dans .forge-catalog et clippe les cards qui debordent
       (le JS calcule cols × rows visibles et pagine en consequence). Pattern
       miroir de .inv-grid (Banque). */
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.forge-loading,
.forge-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 44px 16px;
    color: var(--text-secondary);
    font-size: 0.92rem;
    font-family: 'Roboto Condensed', sans-serif;
    font-style: italic;
    background: rgba(var(--bg-card-rgb, 20, 18, 30), 0.35);
    border: 1px dashed rgba(var(--gold-rgb), 0.2);
    border-radius: 12px;
}

.forge-card {
    position: relative;
    background:
        linear-gradient(180deg,
            color-mix(in srgb, var(--forge-accent, #c9a34a) 14%, rgba(var(--bg-card-rgb, 20, 18, 30), 0.9)) 0%,
            rgba(var(--bg-card-rgb, 20, 18, 30), 0.92) 70%);
    border: 1px solid rgba(var(--gold-rgb), 0.22);
    border-radius: 14px;
    padding: 16px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
    overflow: hidden;
    animation: forge-card-in 0.4s ease both;
}

@keyframes forge-card-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}



.forge-card::after {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px;
    width: 90px;
    height: 90px;
    background: radial-gradient(circle, color-mix(in srgb, var(--forge-accent, #c9a34a) 35%, transparent) 0%, transparent 70%);
    pointer-events: none;
    opacity: 0.6;
}

.forge-card:hover {
    border-color: color-mix(in srgb, var(--forge-accent, #c9a34a) 80%, transparent);
    transform: translateY(-3px);
    box-shadow:
        0 12px 26px rgba(0, 0, 0, 0.45),
        0 0 22px color-mix(in srgb, var(--forge-accent, #c9a34a) 22%, transparent);
}

.forge-card.is-disabled {
    opacity: 0.55;
    filter: grayscale(0.35);
}

.forge-card.is-disabled:hover {
    transform: none;
    box-shadow: none;
    border-color: rgba(var(--gold-rgb), 0.22);
}

.forge-card.is-active {
    border-color: var(--gold);
    box-shadow:
        0 0 0 1px rgba(var(--gold-rgb), 0.6) inset,
        0 0 28px rgba(var(--gold-rgb), 0.25);
    animation: forge-card-active 2.2s ease-in-out infinite;
}

@keyframes forge-card-active {
    0%, 100% { box-shadow: 0 0 0 1px rgba(var(--gold-rgb), 0.6) inset, 0 0 22px rgba(var(--gold-rgb), 0.2); }
    50%      { box-shadow: 0 0 0 1px rgba(var(--gold-rgb), 0.9) inset, 0 0 32px rgba(var(--gold-rgb), 0.4); }
}

/* Refonte 2026-05-15 : layout vertical centré, à l'identique des cards Banque
   (.inv-item) — icône au-dessus, nom dessous, plus de meta "N raretés". */
.forge-card-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    position: relative;
    z-index: 1;
    min-width: 0;
    width: 100%;
}

.forge-card-icon {
    width: 72px;
    height: 72px;
    flex-shrink: 0;
    image-rendering: pixelated;
    background:
        radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--forge-accent, #c9a34a) 20%, transparent), transparent 70%),
        rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 6px;
    border: 1px solid color-mix(in srgb, var(--forge-accent, #c9a34a) 45%, transparent);
    box-shadow:
        0 0 14px color-mix(in srgb, var(--forge-accent, #c9a34a) 18%, transparent),
        0 2px 6px rgba(0, 0, 0, 0.35) inset;
}

.forge-card-title {
    font-family: 'Cinzel', serif;
    font-size: 0.95rem;
    color: var(--text-main);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.2px;
    text-align: center;
    /* Wrap multi-ligne des titres longs (Bottes Tourbillonnantes, Bottes
       Imperméables...) au lieu de déborder hors de la card. */
    overflow-wrap: anywhere;
    word-break: break-word;
    hyphens: auto;
}

.forge-card-sub {
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.forge-card-head-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
    width: 100%;
}

.forge-card-clickable {
    cursor: pointer;
    user-select: none;
}

.forge-card-clickable:focus-visible {
    outline: 2px solid rgba(var(--gold-rgb), 0.8);
    outline-offset: 2px;
}

.forge-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 2px;
    position: relative;
    z-index: 1;
}

.forge-timer-label {
    font-family: 'Oswald', sans-serif;
    font-size: 0.82rem;
    color: var(--text-secondary);
    letter-spacing: 1px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.forge-timer-label::before {
    content: '\2699';
    opacity: 0.75;
    font-size: 0.95rem;
}

/* "En cours" devient un overlay absolute en haut de la card (refonte 2026-05-15,
   suite à la suppression de .forge-card-meta qui le portait précédemment). */
.forge-card-status {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
    font-family: 'Cinzel', serif;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(var(--gold-rgb), 0.15);
    border: 1px solid rgba(var(--gold-rgb), 0.45);
    color: var(--gold);
    pointer-events: none;
}

.forge-card-status.is-missing {
    background: rgba(255, 107, 107, 0.12);
    border-color: rgba(255, 107, 107, 0.45);
    color: var(--forge-warm);
}

/* Card lockée (cristal déjà possédé : règle "1 par espèce") : grisée +
   curseur not-allowed + image désaturée. Hover neutralisé. */
.forge-card.is-locked {
    cursor: not-allowed;
    opacity: 0.55;
    filter: saturate(0.4);
}
.forge-card.is-locked .forge-card-icon {
    filter: grayscale(0.6);
}
.forge-card.is-locked:hover {
    border-color: rgba(var(--gold-rgb), 0.22);
    box-shadow: none;
    transform: none;
}
/* Badge "Déjà possédé" : overlay haut-droite, cadenas inline. */
.forge-card-locked-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 6px;
    font-family: 'Cinzel', serif;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.75);
    pointer-events: none;
    z-index: 2;
}
.forge-card-locked-badge svg {
    flex-shrink: 0;
}

/* ============================================================
 * Modal recette (costs + notice + bouton Forger)
 * ============================================================ */

.forge-modal-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
    text-align: left;
}

.forge-modal-head {
    display: flex;
    align-items: center;
    gap: 14px;
}

.forge-modal-icon {
    width: 72px;
    height: 72px;
    flex-shrink: 0;
    image-rendering: pixelated;
    background:
        radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--forge-accent, #c9a34a) 22%, transparent), transparent 70%),
        rgba(0, 0, 0, 0.35);
    border-radius: 12px;
    padding: 6px;
    border: 1px solid color-mix(in srgb, var(--forge-accent, #c9a34a) 50%, transparent);
    box-shadow:
        0 0 18px color-mix(in srgb, var(--forge-accent, #c9a34a) 22%, transparent),
        0 2px 8px rgba(0, 0, 0, 0.4) inset;
}

.forge-modal-head-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1 1 auto;
}

.forge-modal-name {
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: 0.3px;
    line-height: 1.2;
}

.forge-modal-sub {
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-top: 4px;
}

.forge-modal-timer {
    font-family: 'Oswald', sans-serif;
    font-size: 0.95rem;
    color: var(--text-secondary);
    letter-spacing: 1.2px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.forge-modal-timer .forge-timer-label {
    font-size: inherit;
}

.forge-modal-costs {
    display: flex;
    flex-direction: column;
    gap: 7px;
    font-size: 0.88rem;
    font-family: 'Roboto Condensed', sans-serif;
    padding: 11px 13px;
    background:
        linear-gradient(180deg, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.2));
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.forge-cost {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--text-main);
    font-weight: 500;
}

.forge-cost img {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    image-rendering: pixelated;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}

.forge-cost.is-missing {
    color: var(--forge-warm);
}

.forge-cost.is-missing img {
    filter: grayscale(0.7) brightness(0.8) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}

.forge-cost.is-missing::after {
    content: '!';
    margin-left: auto;
    color: var(--forge-warm);
    font-weight: 800;
    font-family: 'Oswald', sans-serif;
    background: rgba(255, 107, 107, 0.12);
    border: 1px solid rgba(255, 107, 107, 0.4);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    line-height: 1;
}

.forge-modal-notice {
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 0.86rem;
    padding: 9px 12px;
    border-radius: 9px;
    background: rgba(var(--gold-rgb), 0.08);
    border: 1px solid rgba(var(--gold-rgb), 0.3);
    color: var(--text-main);
    line-height: 1.35;
}

.forge-modal-notice.is-active {
    background: rgba(var(--gold-rgb), 0.15);
    border-color: rgba(var(--gold-rgb), 0.55);
    color: var(--gold);
}

.forge-modal-notice.is-busy {
    background: rgba(170, 68, 255, 0.1);
    border-color: rgba(170, 68, 255, 0.45);
    color: var(--forge-accent-light);
}

.forge-modal-notice.is-missing {
    background: rgba(255, 107, 107, 0.1);
    border-color: rgba(255, 107, 107, 0.45);
    color: var(--forge-warm);
}

/* Scope specifique forge : boutons meme taille + Annuler a gauche */
.modal-box:has(.forge-modal-content) .modal-actions {
    justify-content: stretch;
    align-items: stretch;
}

.modal-box:has(.forge-modal-content) .modal-actions .modal-cancel,
.modal-box:has(.forge-modal-content) .modal-actions .modal-confirm {
    flex: 1 1 0;
    padding: 10px 20px;
    margin: 0;
    text-align: center;
    line-height: 1.2;
}

.modal-box:has(.forge-modal-content) .modal-actions .modal-cancel {
    order: 0;
}

.modal-box:has(.forge-modal-content) .modal-actions .modal-confirm {
    order: 1;
}

/* Accents par element */
.forge-card[data-element="fire"]      { --forge-accent: #ff5a3c; }
.forge-card[data-element="water"]     { --forge-accent: #3aaeff; }
.forge-card[data-element="earth"]     { --forge-accent: #7bc96f; }
.forge-card[data-element="lightning"] { --forge-accent: #ffd24a; }
.forge-card[data-element="wind"]      { --forge-accent: #b0e6d5; }

.forge-card[data-tier="5"] { border-color: rgba(255, 136, 0, 0.4); }
.forge-card[data-tier="4"] { border-color: rgba(255, 34, 68, 0.3); }

/* ============================================================
 * Modale detail item (forge-detail-overlay)
 * Selecteur rarete + preview rolls + couts + bouton Forger
 * ============================================================ */

.modal-overlay.forge-detail-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.modal-overlay.forge-detail-overlay.visible {
    opacity: 1;
}

.modal-box.forge-detail-box {
    max-width: 560px;
    width: min(94vw, 560px);
    padding: 22px 24px 18px;
}

.forge-detail-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.forge-detail-head {
    display: flex;
    align-items: center;
    gap: 14px;
}

.forge-detail-icon {
    width: 72px;
    height: 72px;
    flex-shrink: 0;
    image-rendering: pixelated;
    background:
        radial-gradient(circle at 50% 40%, rgba(var(--gold-rgb), 0.22), transparent 70%),
        rgba(0, 0, 0, 0.35);
    border-radius: 12px;
    padding: 6px;
    border: 1px solid rgba(var(--gold-rgb), 0.5);
    box-shadow: 0 0 18px rgba(var(--gold-rgb), 0.22);
}

.forge-detail-title {
    font-family: 'Cinzel', serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: 0.3px;
    line-height: 1.2;
}

.forge-detail-sub {
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-top: 4px;
}

/* Selecteur rarete : 5 boutons style "plaques metalliques" (froid inactif,
   chauffe au rouge quand actif + liser coloré par rarete en bas). */
.forge-rarity-picker {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    padding: 6px;
    background:
        linear-gradient(180deg, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.35) 100%);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4);
}
/* Si la rareté T6 (Primordial pur) est présente, passe à 6 colonnes pour
   accommoder le 6e bouton sans overflow. Le label "Primordial pur" wrap
   naturellement sur 2 lignes (white-space: normal sur le bouton). */
.forge-rarity-picker:has(.forge-rarity-btn:nth-child(6)) {
    grid-template-columns: repeat(6, 1fr);
}

.forge-rarity-btn {
    position: relative;
    padding: 6px 4px;
    background: linear-gradient(180deg, #3c3c44 0%, #1c1c22 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    color: #8a8f96;
    font-family: 'Cinzel', serif;
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    cursor: pointer;
    overflow: hidden;
    /* Layout : flex centered + wrap autorisé pour les labels longs (Primordial pur). */
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: normal;
    line-height: 1.05;
    min-height: 42px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        inset 0 -1px 0 rgba(0, 0, 0, 0.5);
    transition: transform 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.forge-rarity-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    color: #dcdce0;
    border-color: rgba(255, 255, 255, 0.16);
}

.forge-rarity-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.forge-rarity-btn.active {
    color: #fff;
    background: linear-gradient(180deg, #2a1412 0%, #120808 100%);
    border-color: rgba(255, 140, 40, 0.55);
    text-shadow: 0 0 6px rgba(255, 140, 40, 0.5);
}

/* Braise qui pulse depuis le bas - seulement sur l'actif */
.forge-rarity-btn.active::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 115%, rgba(255, 120, 40, 0.85) 0%, transparent 60%);
    pointer-events: none;
    animation: forge-ember-pulse 2.2s ease-in-out infinite;
}

@keyframes forge-ember-pulse {
    0%, 100% { opacity: 0.7; }
    50%      { opacity: 1; }
}

/* Bordure complete coloree par rarete + glow externe */
.forge-rarity-btn[data-tier-key="fragile"].active        { border-color: var(--rarity-fragile);        box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), inset 0 -1px 0 rgba(0,0,0,0.5), 0 0 12px rgba(var(--rarity-fragile-rgb),        0.5); }
.forge-rarity-btn[data-tier-key="robuste"].active        { border-color: var(--rarity-robuste);        box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), inset 0 -1px 0 rgba(0,0,0,0.5), 0 0 14px rgba(var(--rarity-robuste-rgb),        0.6); }
.forge-rarity-btn[data-tier-key="alpha"].active          { border-color: var(--rarity-alpha);          box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), inset 0 -1px 0 rgba(0,0,0,0.5), 0 0 16px rgba(var(--rarity-alpha-rgb),          0.65); }
.forge-rarity-btn[data-tier-key="ancien"].active         { border-color: var(--rarity-ancien);         box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), inset 0 -1px 0 rgba(0,0,0,0.5), 0 0 18px rgba(var(--rarity-ancien-rgb),         0.7); }
.forge-rarity-btn[data-tier-key="primordial"].active     { border-color: var(--rarity-primordial);     box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), inset 0 -1px 0 rgba(0,0,0,0.5), 0 0 22px rgba(var(--rarity-primordial-rgb),     0.8); }
.forge-rarity-btn[data-tier-key="primordial_pur"].active { border-color: var(--rarity-primordial_pur); box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), inset 0 -1px 0 rgba(0,0,0,0.5), 0 0 24px rgba(var(--rarity-primordial_pur-rgb), 0.85); }
/* Label "Primordial pur" plus long que les autres raretés (single-word) :
   on shrink le font + letter-spacing pour le faire tenir sur 1 ligne sans crop. */
.forge-rarity-btn[data-tier-key="primordial_pur"] {
    font-size: 0.62rem;
    letter-spacing: 0.2px;
}

/* Bloc preview (primaire gros + secondaires) */
.forge-preview {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 14px 12px;
    background:
        linear-gradient(180deg, rgba(var(--gold-rgb), 0.06), rgba(0, 0, 0, 0.2));
    border: 1px solid rgba(var(--gold-rgb), 0.18);
    border-radius: 10px;
}

.forge-preview-primary {
    font-family: 'Cinzel', serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: 0.3px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(var(--gold-rgb), 0.22);
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.forge-preview-primary[data-rarity="fragile"]        { color: var(--rarity-fragile); }
.forge-preview-primary[data-rarity="robuste"]        { color: var(--rarity-robuste); }
.forge-preview-primary[data-rarity="alpha"]          { color: var(--rarity-alpha); }
.forge-preview-primary[data-rarity="ancien"]         { color: var(--rarity-ancien); }
.forge-preview-primary[data-rarity="primordial"]     { color: var(--rarity-primordial); text-shadow: 0 0 12px rgba(var(--rarity-primordial-rgb), 0.5); }
.forge-preview-primary[data-rarity="primordial_pur"] { color: var(--rarity-primordial_pur); text-shadow: 0 0 14px rgba(var(--rarity-primordial_pur-rgb), 0.6); }

.forge-preview-tag {
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 500;
    font-style: italic;
    letter-spacing: 0.3px;
    text-shadow: none;
}

.forge-preview-secondaries {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 4px;
}

.forge-preview-secondary {
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 0.9rem;
    color: var(--text-main);
    opacity: 0.9;
    letter-spacing: 0.2px;
}

/* Couts avec rarete visible sur les materiaux */
.forge-detail-costs {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.forge-detail-costs .forge-cost {
    display: grid;
    grid-template-columns: 68px 1fr;
    align-items: center;
    gap: 14px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}

.forge-cost-icon {
    width: 64px;
    height: 64px;
    image-rendering: pixelated;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
    transition: filter 0.15s ease;
}

/* Glow de l'icone materiau selon le tier (pas de cadre dur) */
.forge-cost[data-rarity="fragile"]        .forge-cost-icon { filter: drop-shadow(0 0 5px  rgba(var(--rarity-fragile-rgb),        0.6))  drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5)); }
.forge-cost[data-rarity="robuste"]        .forge-cost-icon { filter: drop-shadow(0 0 7px  rgba(var(--rarity-robuste-rgb),        0.75)) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5)); }
.forge-cost[data-rarity="alpha"]          .forge-cost-icon { filter: drop-shadow(0 0 9px  rgba(var(--rarity-alpha-rgb),          0.8))  drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5)); }
.forge-cost[data-rarity="ancien"]         .forge-cost-icon { filter: drop-shadow(0 0 11px rgba(var(--rarity-ancien-rgb),         0.85)) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5)); }
.forge-cost[data-rarity="primordial"]     .forge-cost-icon { filter: drop-shadow(0 0 14px rgba(var(--rarity-primordial-rgb),     0.9))  drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5)); }
.forge-cost[data-rarity="primordial_pur"] .forge-cost-icon { filter: drop-shadow(0 0 16px rgba(var(--rarity-primordial_pur-rgb), 0.95)) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5)); }

.forge-cost-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.forge-cost-name {
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 0.92rem;
    color: var(--text-main);
    font-weight: 600;
}

.forge-cost-rarity {
    font-size: 0.8rem;
    font-weight: 500;
    font-style: italic;
    margin-left: 4px;
}

.forge-cost[data-rarity="fragile"]        .forge-cost-rarity { color: var(--rarity-fragile); }
.forge-cost[data-rarity="robuste"]        .forge-cost-rarity { color: var(--rarity-robuste); }
.forge-cost[data-rarity="alpha"]          .forge-cost-rarity { color: var(--rarity-alpha); }
.forge-cost[data-rarity="ancien"]         .forge-cost-rarity { color: var(--rarity-ancien); }
.forge-cost[data-rarity="primordial"]     .forge-cost-rarity { color: var(--rarity-primordial); }
.forge-cost[data-rarity="primordial_pur"] .forge-cost-rarity { color: var(--rarity-primordial_pur); }

.forge-cost-qty {
    font-family: 'Oswald', sans-serif;
    font-size: 0.85rem;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.forge-cost-qty.is-missing {
    color: var(--forge-warm);
    font-weight: 600;
}

.forge-cost-ashes .forge-cost-icon {
    filter: drop-shadow(0 0 8px rgba(var(--gold-rgb), 0.55)) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

/* ============================================================
 * Modale reveal (forge-reveal-overlay)
 * Grosse card centrale qui revele l'item force + ses rolls
 * ============================================================ */

.modal-overlay.forge-reveal-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.forge-reveal-overlay.visible {
    opacity: 1;
}

.modal-box.forge-reveal-box {
    position: relative;
    max-width: 520px;
    width: min(92vw, 520px);
    padding: 26px 28px 20px;
    overflow: hidden;
    animation: forge-reveal-in 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.1) both;
}

@keyframes forge-reveal-in {
    from { opacity: 0; transform: scale(0.7) translateY(20px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.forge-reveal-box[data-rarity="fragile"]        { border-color: var(--rarity-fragile); }
.forge-reveal-box[data-rarity="robuste"]        { border-color: var(--rarity-robuste);        box-shadow: 0 0 40px rgba(var(--rarity-robuste-rgb),        0.35); }
.forge-reveal-box[data-rarity="alpha"]          { border-color: var(--rarity-alpha);          box-shadow: 0 0 50px rgba(var(--rarity-alpha-rgb),          0.4); }
.forge-reveal-box[data-rarity="ancien"]         { border-color: var(--rarity-ancien);         box-shadow: 0 0 60px rgba(var(--rarity-ancien-rgb),         0.45); }
.forge-reveal-box[data-rarity="primordial"]     { border-color: var(--rarity-primordial);     box-shadow: 0 0 70px rgba(var(--rarity-primordial-rgb),     0.55); }
.forge-reveal-box[data-rarity="primordial_pur"] { border-color: var(--rarity-primordial_pur); box-shadow: 0 0 80px rgba(var(--rarity-primordial_pur-rgb), 0.65); }

.forge-reveal-head {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 6px 0 16px;
    border-bottom: 1px solid rgba(var(--gold-rgb), 0.22);
    margin-bottom: 14px;
}

.forge-reveal-icon-wrap {
    position: relative;
    width: 120px;
    height: 120px;
}

.forge-reveal-icon {
    display: block;
    width: 120px;
    height: 120px;
    image-rendering: pixelated;
    padding: 10px;
    border-radius: 16px;
    background:
        radial-gradient(circle at 50% 40%, rgba(var(--gold-rgb), 0.3), transparent 70%),
        rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(var(--gold-rgb), 0.55);
    box-shadow:
        0 0 30px rgba(var(--gold-rgb), 0.35),
        0 4px 14px rgba(0, 0, 0, 0.5) inset;
    /* Impact au spawn, puis pulse doux en continu */
    animation:
        forge-reveal-impact 0.7s cubic-bezier(0.2, 0.9, 0.3, 1.15) both,
        forge-reveal-pulse 2.4s ease-in-out 0.7s infinite;
}

@keyframes forge-reveal-impact {
    0%   { transform: scale(1.45); filter: brightness(1.8); }
    45%  { transform: scale(0.94); filter: brightness(1.1); }
    75%  { transform: scale(1.04); filter: brightness(1); }
    100% { transform: scale(1); filter: brightness(1); }
}

/* Etincelles qui fusent depuis l'icone au spawn (14 particules) */
.forge-reveal-sparks {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    pointer-events: none;
}

.forge-reveal-sparks .spark {
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #fff1cc;
    box-shadow: 0 0 8px rgba(255, 200, 120, 0.95);
    opacity: 0;
    animation: forge-reveal-spark 1s ease-out forwards;
}

.forge-reveal-sparks .spark:nth-child(1)  { --dx:  100px; --dy:  -30px; animation-delay: 0.05s; }
.forge-reveal-sparks .spark:nth-child(2)  { --dx:  -100px; --dy: -30px; animation-delay: 0.08s; }
.forge-reveal-sparks .spark:nth-child(3)  { --dx:   85px; --dy:  60px;  animation-delay: 0.12s; }
.forge-reveal-sparks .spark:nth-child(4)  { --dx:  -85px; --dy:  60px;  animation-delay: 0.1s;  }
.forge-reveal-sparks .spark:nth-child(5)  { --dx:    0px; --dy: -110px; animation-delay: 0.06s; }
.forge-reveal-sparks .spark:nth-child(6)  { --dx:   60px; --dy:  95px;  animation-delay: 0.14s; }
.forge-reveal-sparks .spark:nth-child(7)  { --dx:  -60px; --dy:  95px;  animation-delay: 0.16s; }
.forge-reveal-sparks .spark:nth-child(8)  { --dx:  115px; --dy:   15px; animation-delay: 0.1s;  }
.forge-reveal-sparks .spark:nth-child(9)  { --dx: -115px; --dy:   15px; animation-delay: 0.11s; }
.forge-reveal-sparks .spark:nth-child(10) { --dx:   40px; --dy: -85px;  animation-delay: 0.04s; }
.forge-reveal-sparks .spark:nth-child(11) { --dx:  -40px; --dy: -85px;  animation-delay: 0.07s; }
.forge-reveal-sparks .spark:nth-child(12) { --dx:   75px; --dy: -65px;  animation-delay: 0.13s; }
.forge-reveal-sparks .spark:nth-child(13) { --dx:  -75px; --dy: -65px;  animation-delay: 0.15s; }
.forge-reveal-sparks .spark:nth-child(14) { --dx:    0px; --dy:  100px; animation-delay: 0.18s; }

@keyframes forge-reveal-spark {
    0% {
        transform: translate(0, 0) scale(1.6);
        opacity: 1;
    }
    70% {
        opacity: 0.85;
    }
    100% {
        transform: translate(var(--dx, 0), var(--dy, 0)) scale(0.2);
        opacity: 0;
    }
}

.forge-reveal-box[data-rarity="primordial"] .forge-reveal-icon {
    border-color: var(--rarity-primordial);
    box-shadow:
        0 0 40px rgba(var(--rarity-primordial-rgb), 0.6),
        0 4px 14px rgba(0, 0, 0, 0.5) inset;
}
.forge-reveal-box[data-rarity="primordial_pur"] .forge-reveal-icon {
    border-color: var(--rarity-primordial_pur);
    box-shadow:
        0 0 44px rgba(var(--rarity-primordial_pur-rgb), 0.7),
        0 4px 14px rgba(0, 0, 0, 0.5) inset;
}
.forge-reveal-box[data-rarity="ancien"] .forge-reveal-icon {
    border-color: var(--rarity-ancien);
    box-shadow: 0 0 36px rgba(var(--rarity-ancien-rgb), 0.55), 0 4px 14px rgba(0, 0, 0, 0.5) inset;
}
.forge-reveal-box[data-rarity="alpha"] .forge-reveal-icon {
    border-color: var(--rarity-alpha);
    box-shadow: 0 0 32px rgba(var(--rarity-alpha-rgb), 0.5), 0 4px 14px rgba(0, 0, 0, 0.5) inset;
}
.forge-reveal-box[data-rarity="robuste"] .forge-reveal-icon {
    border-color: var(--rarity-robuste);
    box-shadow: 0 0 28px rgba(var(--rarity-robuste-rgb), 0.45), 0 4px 14px rgba(0, 0, 0, 0.5) inset;
}
.forge-reveal-box[data-rarity="fragile"] .forge-reveal-icon {
    border-color: var(--rarity-fragile);
    box-shadow: 0 0 20px rgba(var(--rarity-fragile-rgb), 0.35), 0 4px 14px rgba(0, 0, 0, 0.5) inset;
}

@keyframes forge-reveal-pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.04); }
}

.forge-reveal-title {
    font-family: 'MedievalSharp', 'Cinzel', serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-main);
    text-align: center;
    letter-spacing: 1px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.65);
}

.forge-reveal-rarity {
    font-family: 'Cinzel', serif;
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--gold);
}

.forge-reveal-box[data-rarity="fragile"]        .forge-reveal-rarity { color: var(--rarity-fragile); }
.forge-reveal-box[data-rarity="robuste"]        .forge-reveal-rarity { color: var(--rarity-robuste); }
.forge-reveal-box[data-rarity="alpha"]          .forge-reveal-rarity { color: var(--rarity-alpha); }
.forge-reveal-box[data-rarity="ancien"]         .forge-reveal-rarity { color: var(--rarity-ancien);         text-shadow: 0 0 10px rgba(var(--rarity-ancien-rgb),         0.5); }
.forge-reveal-box[data-rarity="primordial"]     .forge-reveal-rarity { color: var(--rarity-primordial);     text-shadow: 0 0 12px rgba(var(--rarity-primordial-rgb),     0.6); }
.forge-reveal-box[data-rarity="primordial_pur"] .forge-reveal-rarity { color: var(--rarity-primordial_pur); text-shadow: 0 0 14px rgba(var(--rarity-primordial_pur-rgb), 0.7); }

.forge-reveal-rolls {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(var(--gold-rgb), 0.2);
    border-radius: 10px;
}

.forge-reveal-primary {
    font-family: 'Cinzel', serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: 0.3px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(var(--gold-rgb), 0.22);
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.forge-reveal-primary[data-rarity="fragile"]        { color: var(--rarity-fragile); }
.forge-reveal-primary[data-rarity="robuste"]        { color: var(--rarity-robuste); }
.forge-reveal-primary[data-rarity="alpha"]          { color: var(--rarity-alpha); }
.forge-reveal-primary[data-rarity="ancien"]         { color: var(--rarity-ancien);         text-shadow: 0 0 10px rgba(var(--rarity-ancien-rgb),         0.4); }
.forge-reveal-primary[data-rarity="primordial"]     { color: var(--rarity-primordial);     text-shadow: 0 0 12px rgba(var(--rarity-primordial-rgb),     0.55); }
.forge-reveal-primary[data-rarity="primordial_pur"] { color: var(--rarity-primordial_pur); text-shadow: 0 0 14px rgba(var(--rarity-primordial_pur-rgb), 0.65); }

.forge-reveal-tag {
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
    font-style: italic;
    text-shadow: none;
}

.forge-reveal-secondaries {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-top: 6px;
}

.forge-reveal-secondary {
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 0.96rem;
    color: var(--text-main);
    opacity: 0.92;
    letter-spacing: 0.2px;
}

/* Bouton Forger dedie (DA fer forge noir : anthracite + rivets acier + braise discrete) */
.forge-btn-craft {
    position: relative;
    flex: 1 1 auto;
    padding: 13px 26px;
    border: 1px solid rgba(140, 140, 150, 0.55);
    border-radius: 5px;
    background:
        radial-gradient(ellipse at 50% 120%, rgba(255, 90, 30, 0.35) 0%, transparent 55%),
        linear-gradient(180deg, #2a2a2e 0%, #0f0f12 100%);
    color: #ece8e0;
    font-family: 'Cinzel', serif;
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.9), 0 0 8px rgba(255, 120, 50, 0.15);
    cursor: pointer;
    overflow: hidden;
    box-shadow:
        inset 0 1px 0 rgba(200, 200, 210, 0.22),
        inset 0 -2px 0 rgba(0, 0, 0, 0.55),
        0 4px 12px rgba(0, 0, 0, 0.5);
    transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease;
}

/* Rivets aux 2 coins hauts (acier brosse) */
.forge-btn-craft::before,
.forge-btn-craft::after {
    content: '';
    position: absolute;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #e8e8ec 0%, #6a6a70 70%, #2a2a2e 100%);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.9), inset 0 -1px 1px rgba(0, 0, 0, 0.4);
    pointer-events: none;
}
.forge-btn-craft::before { top: 5px; left: 7px; }
.forge-btn-craft::after  { top: 5px; right: 7px; }

.forge-btn-craft:hover:not(:disabled) {
    transform: translateY(-1px);
    background:
        radial-gradient(ellipse at 50% 115%, rgba(255, 110, 40, 0.55) 0%, transparent 60%),
        linear-gradient(180deg, #34343a 0%, #151519 100%);
    box-shadow:
        inset 0 1px 0 rgba(220, 220, 230, 0.3),
        inset 0 -2px 0 rgba(0, 0, 0, 0.6),
        0 6px 20px rgba(0, 0, 0, 0.6),
        0 0 22px rgba(255, 100, 30, 0.25);
    animation: forge-btn-vibrate 0.35s ease-in-out infinite;
}

@keyframes forge-btn-vibrate {
    0%, 100% { transform: translateY(-1px) translateX(0); }
    25%      { transform: translateY(-1px) translateX(-0.6px); }
    75%      { transform: translateY(-1px) translateX(0.6px); }
}

.forge-btn-craft:active:not(:disabled) {
    transform: translateY(0);
    animation: forge-btn-impact 0.4s ease-out;
}

@keyframes forge-btn-impact {
    0% {
        box-shadow:
            inset 0 2px 6px rgba(0, 0, 0, 0.6),
            0 0 0 0 rgba(255, 120, 40, 0.9);
    }
    50% {
        box-shadow:
            inset 0 2px 6px rgba(0, 0, 0, 0.6),
            0 0 45px 10px rgba(255, 100, 30, 0.6);
    }
    100% {
        box-shadow:
            inset 0 2px 6px rgba(0, 0, 0, 0.6),
            0 0 0 0 rgba(255, 100, 30, 0);
    }
}

.forge-btn-craft:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    filter: grayscale(0.7) brightness(0.7);
    animation: none !important;
}

/* Bouton "Fermer" de la modale forge : version ghost assortie (cadre acier
   sombre, pas de fond plein, reste secondaire). */
.forge-btn-ghost {
    position: relative;
    flex: 0 0 auto;
    padding: 11px 22px;
    border: 1px solid rgba(140, 140, 150, 0.4);
    border-radius: 5px;
    background: linear-gradient(180deg, rgba(30, 30, 34, 0.85) 0%, rgba(10, 10, 14, 0.9) 100%);
    color: #bbb7b0;
    font-family: 'Cinzel', serif;
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.9);
    cursor: pointer;
    box-shadow:
        inset 0 1px 0 rgba(200, 200, 210, 0.12),
        inset 0 -1px 0 rgba(0, 0, 0, 0.5);
    transition: transform 0.12s ease, color 0.15s ease, border-color 0.15s ease;
}
.forge-btn-ghost:hover:not(:disabled) {
    color: #e8e4dc;
    border-color: rgba(180, 180, 195, 0.6);
    transform: translateY(-1px);
}
.forge-btn-ghost:active:not(:disabled) {
    transform: translateY(0);
}

/* Ajustement de l'alignement des actions dans la modale detail */
.modal-box.forge-detail-box .modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

/* Notice (busy / missing) dans la modale detail */
.forge-detail-content .forge-modal-notice {
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 0.88rem;
    padding: 9px 12px;
    border-radius: 9px;
    line-height: 1.35;
}

/* Onglet Reforge : cache le pager (pas de pagination en mode reforge). Classe
   plutot que l'attribut HTML `hidden` car .inv-pagination (admin.css) force
   display:flex et override hidden natif. */
#forge-pagination.is-reforge-hidden { display: none !important; }

/* ============================================================
 * Reforge tab (feature 2026-05-16)
 * Remplace #forge-grid quand SELECTED_SLOT === 'reforge'. Picker + locks + cost.
 * ============================================================ */

/* Override du grid parent quand on est en mode Reforge : abandonne le layout
   repeat(auto-fill, 200px) pour un panel centré pleine largeur. */
.forge-grid.is-reforge-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    grid-template-columns: none;
    grid-auto-rows: auto;
    overflow-y: auto;
    padding: 8px 0;
}

/* Empty state : grand bloc centré stylé (avant de choisir un item). */
.forge-reforge-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    width: min(620px, 92%);
    /* Plus de centrage vertical (margin: auto consommait l'espace flex et
       collait le bloc au milieu). Marge top fixe → reste collé en haut du
       parent (.forge-grid.is-reforge-tab justify-content: flex-start). */
    margin: 24px auto 0;
    padding: 36px 28px;
    background:
        radial-gradient(circle at top, rgba(var(--gold-rgb), 0.10), transparent 65%),
        linear-gradient(135deg, rgba(20, 12, 8, 0.55), rgba(35, 25, 18, 0.4));
    border: 1px solid rgba(var(--gold-rgb), 0.35);
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(var(--gold-rgb), 0.15);
    text-align: center;
}
.forge-reforge-empty-title {
    font-family: 'Cinzel', serif;
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: var(--gold);
    text-shadow: 0 0 18px rgba(var(--gold-rgb), 0.4);
}
.forge-reforge-empty-sub {
    color: var(--text-secondary);
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 0.94rem;
    line-height: 1.55;
    max-width: 480px;
}
.forge-reforge-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 14px 32px;
    background: linear-gradient(135deg, rgba(var(--gold-rgb), 0.18), rgba(var(--gold-rgb), 0.08));
    border: 1px solid var(--gold);
    border-radius: 10px;
    color: var(--gold);
    font-family: 'Cinzel', serif;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 6px 18px rgba(var(--gold-rgb), 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.forge-reforge-cta-btn:hover {
    background: linear-gradient(135deg, rgba(var(--gold-rgb), 0.32), rgba(var(--gold-rgb), 0.16));
    transform: translateY(-2px);
    box-shadow: 0 10px 26px rgba(var(--gold-rgb), 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.forge-reforge-cta-plus {
    font-size: 1.6rem;
    line-height: 1;
    color: var(--gold);
    text-shadow: 0 0 12px rgba(var(--gold-rgb), 0.5);
}
.forge-reforge-cta-label { letter-spacing: 1.8px; }
.forge-reforge-tips {
    display: flex;
    flex-direction: column;
    gap: 9px;
    margin-top: 6px;
    width: 100%;
    max-width: 460px;
}
.forge-reforge-tip {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(var(--gold-rgb), 0.18);
    border-radius: 8px;
    color: var(--text-main);
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 0.88rem;
    line-height: 1.4;
    text-align: left;
}
.forge-reforge-tip strong { color: var(--gold-text-warm); }

/* Basse résolution verticale (laptops 768/900) : compresser le panel pour
   éviter le scroll vertical sur l'onglet Reforge. Réduit padding, gap, fonts
   sans casser la lisibilité. */
@media (max-height: 900px) {
    .forge-reforge-empty-state {
        gap: 12px;
        padding: 22px 24px;
        margin-top: 16px;
    }
    .forge-reforge-empty-title { font-size: 1.3rem; letter-spacing: 2px; }
    .forge-reforge-empty-sub { font-size: 0.86rem; line-height: 1.4; }
    .forge-reforge-cta-btn { padding: 11px 26px; font-size: 0.98rem; }
    .forge-reforge-cta-plus { font-size: 1.35rem; }
    .forge-reforge-tips { gap: 6px; margin-top: 2px; }
    .forge-reforge-tip { padding: 7px 11px; font-size: 0.82rem; line-height: 1.3; }
}
@media (max-height: 760px) {
    .forge-reforge-empty-state {
        gap: 8px;
        padding: 14px 20px;
        margin-top: 8px;
    }
    .forge-reforge-empty-title { font-size: 1.1rem; letter-spacing: 1.6px; }
    .forge-reforge-empty-sub { font-size: 0.78rem; line-height: 1.3; max-width: 420px; }
    .forge-reforge-empty-sub br { display: none; }
    .forge-reforge-cta-btn { padding: 8px 22px; font-size: 0.9rem; }
    .forge-reforge-cta-plus { font-size: 1.15rem; }
    .forge-reforge-tips { gap: 4px; margin-top: 0; }
    .forge-reforge-tip { padding: 5px 9px; font-size: 0.76rem; line-height: 1.25; }
}

.forge-reforge-wrap {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 6px 4px;
    width: min(760px, 100%);
    margin: 0 auto;
}
.forge-reforge-hint {
    color: var(--text-secondary);
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 0.85rem;
    line-height: 1.45;
    padding: 8px 12px;
    background: rgba(var(--gold-rgb), 0.05);
    border-left: 2px solid rgba(var(--gold-rgb), 0.4);
    border-radius: 0 6px 6px 0;
}
.forge-reforge-slot.is-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 28px 18px;
    background: rgba(0, 0, 0, 0.25);
    border: 2px dashed rgba(var(--gold-rgb), 0.4);
    border-radius: 12px;
    color: var(--gold-text-warm);
    font-family: 'Oswald', sans-serif;
    font-size: 0.95rem;
    letter-spacing: 1.2px;
    cursor: pointer;
    transition: all 0.18s ease;
}
.forge-reforge-slot.is-empty:hover {
    background: rgba(var(--gold-rgb), 0.1);
    border-color: var(--gold);
    transform: translateY(-1px);
}
.forge-reforge-slot-plus { font-size: 2rem; line-height: 1; color: var(--gold); }
.forge-reforge-slot-label { text-transform: uppercase; }
.forge-reforge-detail {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    background: linear-gradient(135deg, rgba(0,0,0,0.35), rgba(20,15,10,0.25));
    border: 1px solid rgba(var(--gold-rgb), 0.3);
    border-radius: 12px;
}
.forge-reforge-change-btn {
    align-self: flex-end;
    background: transparent;
    border: 1px solid rgba(var(--gold-rgb), 0.25);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 5px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s ease;
}
.forge-reforge-change-btn:hover {
    border-color: var(--gold);
    color: var(--gold-text-warm);
}
.forge-reforge-detail-head { display: flex; align-items: center; gap: 14px; }
.forge-reforge-detail-icon {
    width: 64px; height: 64px;
    object-fit: contain;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(var(--gold-rgb), 0.25);
    border-radius: 8px;
    padding: 4px;
}
.forge-reforge-detail-info { display: flex; flex-direction: column; gap: 4px; }
.forge-reforge-detail-name {
    font-family: 'Cinzel', serif;
    color: var(--gold-text-warm);
    font-size: 1.05rem;
    letter-spacing: 0.8px;
}
.forge-reforge-detail-meta {
    color: var(--text-secondary);
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}
.forge-reforge-section-title {
    margin-top: 4px;
    font-family: 'Oswald', sans-serif;
    font-size: 0.78rem;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--gold-text-warm);
    border-bottom: 1px solid rgba(var(--gold-rgb), 0.18);
    padding-bottom: 3px;
}
.forge-reforge-stats { display: flex; flex-direction: column; gap: 4px; }
.forge-reforge-stat { font-family: 'Oswald', sans-serif; font-size: 0.92rem; color: var(--text-main); }
.forge-reforge-stat.is-primary { color: var(--gold); font-weight: 700; }
.forge-reforge-substats { display: flex; flex-direction: column; gap: 6px; }
.forge-reforge-substat {
    display: grid;
    grid-template-columns: 28px 1fr;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(var(--gold-rgb), 0.04);
    border: 1px solid rgba(var(--gold-rgb), 0.18);
    border-radius: 7px;
    transition: background 0.15s, border-color 0.15s;
}
.forge-reforge-substat.is-locked {
    background: rgba(var(--gold-rgb), 0.16);
    border-color: var(--gold);
}
.forge-reforge-lock-btn {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(var(--gold-rgb), 0.4);
    border-radius: 6px;
    color: rgba(var(--gold-rgb), 0.55);
    cursor: pointer;
    padding: 0;
    transition: all 0.15s ease;
}
.forge-reforge-lock-btn:hover {
    border-color: var(--gold);
    color: var(--gold-text-warm);
    background: rgba(var(--gold-rgb), 0.12);
}
.forge-reforge-lock-btn.is-locked {
    background: rgba(var(--gold-rgb), 0.25);
    border-color: var(--gold);
    color: var(--gold);
    box-shadow: 0 0 8px rgba(var(--gold-rgb), 0.35);
}
.forge-reforge-substat-label {
    font-family: 'Oswald', sans-serif;
    font-size: 0.9rem;
    color: var(--text-main);
}
.forge-reforge-mult-info {
    color: var(--gold-text-warm);
    font-family: 'Oswald', sans-serif;
    font-size: 0.85rem;
    letter-spacing: 0.6px;
    text-align: center;
    padding: 6px 10px;
    background: rgba(var(--gold-rgb), 0.08);
    border-radius: 6px;
}
.forge-reforge-costs { display: flex; flex-direction: column; gap: 5px; }
.forge-reforge-cost-line {
    display: grid;
    grid-template-columns: 24px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 6px;
    font-family: 'Oswald', sans-serif;
    font-size: 0.86rem;
}
.forge-reforge-cost-line.is-missing {
    background: rgba(var(--stat-red-rgb), 0.15);
}
.forge-reforge-cost-line.is-missing .forge-reforge-cost-val,
.forge-reforge-cost-line.is-missing .forge-reforge-cost-label { color: var(--stat-red-light, #ff7a6a); }
.forge-reforge-cost-label { color: var(--text-secondary); }
.forge-reforge-cost-val { font-weight: 700; color: var(--text-main); }
.forge-reforge-cost-line .inline-icon { width: 22px; height: 22px; object-fit: contain; }
/* Rarete entre parentheses dans le nom de la ressource — colorisee selon
   le tier via --rarity-color (defini par inv-tier-N sur le parent). */
.forge-reforge-cost-rarity {
    color: var(--rarity-color, var(--text-secondary));
    font-weight: 700;
    font-size: 0.82rem;
    margin-left: 2px;
}

/* Picker reforge style banque : reuse de .reserve-bank-picker (admin.css /
   reserve.css). Variante .is-centered : positionnement au milieu de la
   viewport (modale style) au lieu du near-anchor habituel. */
.reserve-bank-picker.forge-reforge-bank-picker {
    z-index: 4200;
}
.reserve-bank-picker.forge-reforge-bank-picker.is-centered {
    position: fixed;
    /* !important pour battre les inline `style="left:Npx;top:Npx"` qui
       pourraient subsister d'un usage near-anchor antérieur. */
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translate(-50%, -50%);
    width: min(560px, 92vw);
    max-height: min(80vh, 720px);
    z-index: 4500;
}
.reserve-bank-picker.forge-reforge-bank-picker .rbp-item-tag {
    margin-left: 4px;
    padding: 1px 6px;
    border-radius: 3px;
    background: rgba(var(--gold-rgb), 0.18);
    color: var(--gold-text-warm);
    font-size: 0.7rem;
}
.forge-reforge-active {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px;
    background: linear-gradient(135deg, rgba(var(--gold-rgb), 0.08), rgba(0,0,0,0.35));
    border: 1px solid rgba(var(--gold-rgb), 0.4);
    border-radius: 12px;
    text-align: center;
}
.forge-reforge-active-head { display: flex; align-items: center; gap: 14px; text-align: left; }
.forge-reforge-active-icon {
    width: 64px; height: 64px;
    object-fit: contain;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(var(--gold-rgb), 0.3);
    border-radius: 8px;
    padding: 4px;
}
.forge-reforge-active-info { display: flex; flex-direction: column; gap: 4px; }
.forge-reforge-active-name { font-family: 'Cinzel', serif; color: var(--gold-text-warm); font-size: 1rem; }
.forge-reforge-active-meta { color: var(--text-secondary); font-size: 0.78rem; }
.forge-reforge-active-locks { color: var(--gold-text-warm); font-size: 0.78rem; margin-top: 2px; }
.forge-reforge-active-timer {
    font-family: 'Oswald', sans-serif;
    font-size: 1.2rem;
    letter-spacing: 1.5px;
    color: var(--gold);
    text-shadow: 0 0 12px rgba(var(--gold-rgb), 0.4);
}
.forge-reforge-reveal-name {
    font-family: 'Cinzel', serif;
    color: var(--gold);
    font-size: 1.05rem;
    text-align: center;
    margin-bottom: 8px;
}
.forge-reforge-reveal-stats {
    margin: 0;
    padding-left: 1.2rem;
    color: var(--text-main);
    font-family: 'Oswald', sans-serif;
}
.forge-reforge-reveal-stats li { margin-bottom: 3px; }
