:root {
    --bg-dark: #0d0d0d;
    --panel-bg: rgba(20, 20, 25, 0.85);
    --accent-gold: #ffdca1; /* Stitch Primary */
    --accent-gold-dark: #ffba20;
    --accent-copper: #b87333;
    --text-main: #e5e2e1; /* Stitch on-surface */
    --text-dim: #d5c4ab; /* Stitch on-surface-variant */
    --rarity-commun: #888;
    --rarity-rare: #2196F3;
    --rarity-heroic: #9C27B0;
    --rarity-legend: #FF9800;
    --rarity-héroïque: #9C27B0;
    --rarity-légendaire: #FF9800;
    --stat-green: #4CAF50;
    --stat-red: #ffb4ab; /* Stitch error */
    --safe-bottom: env(safe-area-inset-bottom);
    
    /* Stitch Specific Tokens */
    --s-surface: #131313;
    --s-surface-container: #20201f;
    --s-surface-variant: #353535;
    --s-outline: #9e8f78;
    --s-outline-variant: #514532;
    --s-primary-container: #ffb800;
    
    --font-header: 'Newsreader', serif;
    --font-body: 'Work Sans', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    overscroll-behavior: none;
    -webkit-overflow-scrolling: auto;
    touch-action: pan-y;
}
body {
    background-color: var(--s-surface);
    color: var(--text-main);
    font-family: var(--font-body);
    line-height: 1.6;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    position: fixed;
    width: 100%;
    inset: 0;
}

body.stitch-theme {
    background-color: #131313;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
}

.texture-stone {
    background-color: #1a1a1a;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
}

.texture-wood {
    background-color: #2b1f13;
    background-image: linear-gradient(90deg, rgba(0,0,0,0.3) 0%, rgba(255,255,255,0.05) 50%, rgba(0,0,0,0.3) 100%), url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.01 0.4' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.08'/%3E%3C/svg%3E");
}

.border-metal {
    border: 2px solid var(--s-outline-variant);
    box-shadow: inset 1px 1px 0px rgba(255,255,255,0.1), inset -1px -1px 0px rgba(0,0,0,0.5), 0 2px 4px rgba(0,0,0,0.5);
}

.panel-engraved {
    background-color: var(--s-surface);
    box-shadow: inset 2px 2px 8px rgba(0,0,0,0.8), inset -1px -1px 2px rgba(255,255,255,0.05);
    border: 1px solid #0a0a0a;
}

.progress-channel {
    background-color: #0e0e0e;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.8);
    border: 1px solid var(--s-outline-variant);
}

.progress-fill-xp {
    background: linear-gradient(90deg, #b87333 0%, #ffba20 100%);
    box-shadow: 0 0 10px rgba(255,186,32,0.4), inset 0 1px 2px rgba(255,255,255,0.4);
}

.rpg-font {
    font-family: var(--font-header);
    text-transform: none; /* Stitch doesn't use all-caps for everything */
    letter-spacing: 0;
    font-weight: 700;
}

.parchment-font {
    font-family: 'Dancing Script', cursive;
    color: #4a3121;
}

/* ==================== LAYOUT ==================== */
#app-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    max-width: 500px;
    margin: 0 auto;
    position: relative;
}

header {
    padding: calc(30px + env(safe-area-inset-top)) 15px 15px;
    text-align: center;
    background: linear-gradient(to bottom, rgba(0,0,0,0.9), transparent);
    z-index: 1500;
}

header h1 {
    font-size: 1.2rem;
    color: var(--accent-gold);
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
    font-weight: 800;
}

.screen {
    flex: 1;
    display: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 15px;
    padding-top: calc(15px + env(safe-area-inset-top));
    padding-bottom: calc(85px + var(--safe-bottom));
}

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.2s ease-out; }
.tab-content { overscroll-behavior: contain; }

.hidden { display: none !important; }

.screen.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes xpFadeUpOut {
    0% { opacity: 0; transform: translate(-50%, 20%); }
    20% { opacity: 1; transform: translate(-50%, -50%); }
    80% { opacity: 1; transform: translate(-50%, -50%); }
    100% { opacity: 0; transform: translate(-50%, -150%); }
}

.glass-panel {
    background: var(--s-surface-container);
    border: 1px solid var(--s-outline-variant);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 1px 1px rgba(255,255,255,0.05);
    position: relative;
    overflow: hidden;
}

.glass-panel::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.02'/%3E%3C/svg%3E");
    pointer-events: none;
}

/* ==================== ONBOARDING ==================== */
.onboarding-step {
    display: none;
    text-align: center;
}

.onboarding-step.active {
    display: block;
    animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.class-card {
    background: rgba(255,255,255,0.05);
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    display: flex;
    align-items: center;
}

.class-card.selected {
    border-color: var(--accent-gold);
    background: rgba(212, 175, 55, 0.1);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.2);
}

.class-icon {
    width: 60px;
    height: 60px;
    margin-right: 15px;
    background: #222;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.class-info h4 { color: var(--accent-gold); margin-bottom: 4px; }
.class-info p { font-size: 0.8rem; color: var(--text-dim); line-height: 1.2; }

/* ==================== NAV BOTTOM ==================== */
.main-tabs {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 500px;
    height: calc(75px + var(--safe-bottom));
    background-color: #1a1a1a;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
    border-top: 4px solid #2a2a2a;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.8), 0 -4px 15px rgba(0,0,0,0.5);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding-bottom: var(--safe-bottom);
    z-index: 1000;
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: all 0.3s ease;
    opacity: 0.6;
    position: relative; /* Needed for badge absolute positioning */
}

.tab-btn i {
    font-size: 1.3rem;
    transition: transform 0.2s;
}

.tab-btn.active {
    color: var(--accent-gold);
    opacity: 1;
    text-shadow: 0 0 10px rgba(255, 220, 161, 0.3);
}

.tab-btn.active i {
    transform: translateY(-2px);
    filter: drop-shadow(0 0 5px var(--accent-gold));
}

/* ==================== INVENTORY ORNA STYLE ==================== */
.inventory-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
    padding-top: 10px;
}

#display-name {
    font-size: 1.8rem;
    margin-bottom: 2px;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

#display-subtitle {
    font-size: 0.9rem;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.currency-row {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
}

.currency-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 800;
    font-size: 0.9rem;
}

.gold { color: #FFD700; }
.gems { color: #00BFFF; }

.character-display-container {
    width: 100%;
    max-width: 300px;
    margin: 10px auto;
    position: relative;
    display: grid;
    grid-template-areas: 
        ".     tete   .    "
        "arme  avatar mains"
        ".     torse  .    "
        ".     pieds  .    ";
    grid-template-columns: 75px 1fr 75px;
    grid-template-rows: 75px auto 75px 75px;
    justify-items: center;
    align-items: center;
    gap: 8px;
}

.avatar-large-center {
    grid-area: avatar;
    width: 120px;
    height: 120px;
    z-index: 5;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gear-slot {
    width: 65px;
    height: 65px;
    background: rgba(0,0,0,0.8);
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    z-index: 10;
    transition: all 0.2s;
    cursor: pointer;
    overflow: hidden;
}

.gear-slot img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border: none !important;
    border-radius: 0;
}
#forge-list .gear-slot {
    margin: 0 auto;
    text-align: center;
}
#modal-icon {
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}
#modal-icon img, #modal-icon svg {
    margin: 0 auto;
}

.slot-tete  { grid-area: tete; }
.slot-arme  { grid-area: arme; }
.slot-torse { grid-area: torse; }
.slot-mains { grid-area: mains; }
.slot-pieds { grid-area: pieds; }

/* Rarity Borders - Stronger V4.9 */
.rarity-rare { border-color: #2196F3 !important; box-shadow: 0 0 15px rgba(33, 150, 243, 0.4); }
.rarity-heroic, .rarity-héroïque { border-color: #9C27B0 !important; box-shadow: 0 0 15px rgba(156, 39, 176, 0.4); }
.rarity-legend, .rarity-légendaire { border-color: #FF9800 !important; box-shadow: 0 0 20px rgba(255, 152, 0, 0.5); }
.rarity-commun { border-color: #555 !important; }

.slot-label {
    position: absolute;
    bottom: -14px;
    font-size: 0.5rem;
    color: #666;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 1px;
}


/* Backpack Mini-button */
.backpack-trigger {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 65px;
    height: 65px;
    background: linear-gradient(135deg, var(--accent-copper), #4a3121);
    border-radius: 50%;
    border: 3px solid var(--accent-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    z-index: 90;
    cursor: pointer;
}

/* ==================== BUTTONS & INPUTS ==================== */
.btn {
    display: inline-block;
    width: 100%;
    padding: 14px 20px;
    background: #2b1f13; 
    background-image: linear-gradient(rgba(255,255,255,0.05), rgba(0,0,0,0.2));
    color: var(--accent-gold);
    border: 2px solid #514532;
    border-radius: 8px;
    font-family: var(--font-header);
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    box-shadow: 0 4px 0 #1a130c, 0 6px 10px rgba(0,0,0,0.5);
    transition: all 0.1s;
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #1a130c, 0 2px 5px rgba(0,0,0,0.5);
}

.btn-secondary {
    background: rgba(255,255,255,0.05);
    border: 1px solid #444;
    color: #ccc;
}

.btn-blackmarket {
    width: auto !important;
    min-width: 200px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
    text-transform: none !important;
    letter-spacing: 0.5px;
    background: #5a0e0e !important;
    background-image: linear-gradient(180deg, rgba(180, 30, 30, 0.3), rgba(60, 5, 5, 0.45)) !important;
    color: #f5e0c0 !important;
    border: 2px solid #a83030 !important;
    padding: 12px 22px !important;
    box-shadow: 0 4px 0 #2a0505, 0 6px 10px rgba(0,0,0,0.5);
}
.btn-blackmarket:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #2a0505, 0 2px 5px rgba(0,0,0,0.5);
}
.btn-blackmarket i {
    margin: 0 0 0 -2px;
}

/* V4.18.10 : Bouton d'action unifié (rouge plus sombre — test) pour Intendant + Acheter caisse */
.btn-action {
    width: 100% !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: #5a0e0e !important;
    background-image: linear-gradient(180deg, rgba(180, 30, 30, 0.25), rgba(40, 3, 3, 0.5)) !important;
    color: #f5e0c0 !important;
    border: 2px solid #8b1a1a !important;
    padding: 12px 18px !important;
    font-size: 0.85rem !important;
    font-weight: 800;
    box-shadow: 0 4px 0 #2a0505, 0 6px 10px rgba(0,0,0,0.5);
}
.btn-action:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #2a0505, 0 2px 5px rgba(0,0,0,0.5);
}
.btn-action i { color: #FFD700; }

/* XP Bar V4.8 */
.xp-container {
    width: 100%;
    max-width: 200px;
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    margin: 5px 0 15px;
    overflow: hidden;
    position: relative;
}

.xp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2980b9);
    width: 0%;
    transition: width 0.5s ease-out;
}

.backpack-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    max-height: 250px;
    overflow-y: auto;
    padding: 10px;
}

/* ==================== CHAT ==================== */
.chat-container {
    height: 300px;
    display: flex;
    flex-direction: column;
}

/* ==================== CHAT ÉPURÉ ==================== */
.chat-messages {
    background: #0d0d0d;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 18px;
    position: relative;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    font-size: 0.85rem;
    line-height: 1.4;
    word-wrap: break-word;
}

/* Bulle Autre (Gauche) */
.msg-other {
    align-self: flex-start;
    background-color: #202c33;
    color: #e9edef;
    border-top-left-radius: 0;
}

/* Bulle Soi (Droite) V4.9 - WhatsApp Original */
.msg-me {
    align-self: flex-end !important;
    background-color: #005c4b !important;
    color: #e9edef;
    border-top-right-radius: 0;
    margin-left: 20%;
    box-shadow: -2px 2px 5px rgba(0,0,0,0.2);
}

.msg-other {
    align-self: flex-start !important;
    background-color: #202c33;
    color: #e9edef;
    border-top-left-radius: 0;
    margin-right: 20%;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.2);
}

.msg-author { 
    font-weight: 800; 
    font-size: 0.7rem; 
    margin-bottom: 2px;
    color: var(--accent-gold);
    display: flex;
    align-items: center;
    gap: 4px;
}

.chat-input-row {
    display: flex;
    gap: 8px;
    padding: 10px;
}

/* ==================== TAILORED SVGS ==================== */
.item-icon-svg {
    width: 40px;
    height: 40px;
    image-rendering: pixelated;
}

/* ==================== TOAST & MODAL ==================== */
#toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.95);
    border: 2px solid var(--accent-gold);
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    z-index: 99999 !important; /* Force top priority V4.12 */
    font-size: 0.9rem;
    font-weight: 700;
    text-align: center;
    min-width: 240px;
    opacity: 0;
    transition: opacity 0.3s, visibility 0.3s;
    visibility: hidden;
    pointer-events: none;
    box-shadow: 0 0 30px rgba(0,0,0,0.8);
}

#toast.show { 
    opacity: 1; 
    visibility: visible;
}

.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.9);
    z-index: 4000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#item-modal {
    z-index: 4500; /* Force over backpack */
}

.modal-panel {
    background: #131313;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
    border: 4px solid #2a2a2a;
    border-image: linear-gradient(to bottom, #3a3a3a, #1a1a1a) 1;
    border-radius: 4px; /* More blocky for stone look */
    width: 100%;
    max-width: 420px;
    padding: 30px 20px 20px;
    text-align: center;
    max-height: 85vh;
    overflow-y: auto;
    overflow-x: hidden; /* V4.18.16 : empêche le scroll horizontal parasite */
    position: relative;
    box-sizing: border-box;
    box-shadow: 0 20px 50px rgba(0,0,0,0.9), inset 0 0 100px rgba(0,0,0,0.5);
}

@media (max-width: 480px) {
    .modal-panel {
        max-width: 92% !important;
        margin: 0 auto;
    }
}

/* Icon Buttons Navigation (Stitch Style) - Unified V4.18.2 + V4.18.8 wood frame */
.icon-nav-btn, .tavern-icon-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 5px;
    background-color: #2b1f13;
    background-image:
        radial-gradient(circle at 12px 12px, #1a1208 0 3px, transparent 4px),
        radial-gradient(circle at calc(100% - 12px) 12px, #1a1208 0 3px, transparent 4px),
        radial-gradient(circle at 12px calc(100% - 12px), #1a1208 0 3px, transparent 4px),
        radial-gradient(circle at calc(100% - 12px) calc(100% - 12px), #1a1208 0 3px, transparent 4px),
        linear-gradient(90deg, rgba(0,0,0,0.3) 0%, rgba(255,255,255,0.05) 50%, rgba(0,0,0,0.3) 100%),
        url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.01 0.4' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.08'/%3E%3C/svg%3E");
    border: 2px solid var(--s-outline-variant);
    border-radius: 12px;
    color: var(--accent-gold);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    min-height: 90px;
    position: relative;
    box-shadow: inset 1px 1px 0px rgba(255,255,255,0.1), inset -1px -1px 0px rgba(0,0,0,0.5), 0 4px 10px rgba(0,0,0,0.4);
    font-family: var(--font-header);
    font-weight: 800;
}

.icon-nav-btn:active, .tavern-icon-btn:active {
    transform: scale(0.95);
    background: var(--s-surface-container-highest);
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

.icon-nav-btn i, .tavern-icon-btn i, 
.icon-nav-btn span.material-symbols-outlined, .tavern-icon-btn span.material-symbols-outlined {
    font-size: 2rem !important;
    color: var(--accent-gold);
    filter: drop-shadow(0 0 5px rgba(212, 175, 55, 0.3));
    opacity: 1;
}

.icon-nav-btn span.btn-label, .tavern-icon-btn span {
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    text-align: center;
    line-height: 1.1;
}

/* V4.18.10 : pastilles boutons — même style que tab (top-right, rondes, même dim/police) */
.icon-nav-btn .badge, .tavern-icon-btn .badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #e74c3c;
    color: white;
    font-size: 0.6rem;
    font-weight: 900;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    width: 18px;
    height: 18px;
    padding: 0;
    border-radius: 50%;
    border: 2px solid var(--s-surface);
    box-shadow: 0 2px 6px rgba(231,76,60,0.5);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    text-align: center;
}
.icon-nav-btn .badge[data-double], .tavern-icon-btn .badge[data-double] {
    width: 22px;
    border-radius: 11px;
}

/* Tavern Specific Grid */
.tavern-grid-buttons {
    display: flex;
    justify-content: space-around;
    gap: 15px;
    margin-bottom: 25px;
}

.tavern-intro {
    background: rgba(212, 175, 55, 0.1);
    border: 1px dashed var(--accent-gold);
    padding: 12px;
    border-radius: 10px;
    font-size: 0.8rem;
    color: var(--accent-gold);
    margin-bottom: 20px;
    text-align: center;
}

/* Authentic Parchment Style V4.6 */
.voucher-paper {
    background: url('../img/parchemin.png') center/100% 100% no-repeat;
    background-color: transparent;
    padding: 150px 50px 130px;
    aspect-ratio: 452 / 640;
    max-width: 400px;
    margin: 0 auto;
    border-radius: 0;
    box-shadow: 0 0 20px rgba(0,0,0,0.6);
    position: relative;
    border: none;
    color: #4a3121;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 12px;
}
.voucher-paper > * {
    text-align: center;
}
.voucher-paper h2.rpg-font {
    font-size: 1.5rem !important;
    font-weight: 900;
    color: #4a3121;
    text-shadow: 1px 1px 0 rgba(255, 240, 200, 0.6);
    letter-spacing: 3px;
    text-transform: uppercase;
    margin: 0 0 5px 0;
    width: 100%;
}
.voucher-paper p[style*="font-style:italic"] {
    font-size: 0.78rem !important;
    margin: 5px 0 !important;
    line-height: 1.4;
    width: 100%;
}
.voucher-paper p[style*="Présente ce bon"],
.voucher-paper p[style*="font-size:0.8rem; opacity:0.8"] {
    font-size: 0.7rem !important;
    margin-top: 8px !important;
    opacity: 0.8;
    width: 100%;
}
.voucher-paper .signature {
    font-size: 1rem;
    margin-top: 5px;
    width: 100%;
}
#voucher-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
    font-size: inherit !important;
    font-weight: inherit !important;
    color: inherit !important;
}
#voucher-content img.voucher-enchant,
.voucher-paper .voucher-enchant,
.voucher-enchant {
    display: block !important;
    margin: 0 auto 6px !important;
    width: 75px !important;
    height: 75px !important;
    filter: drop-shadow(0 0 8px rgba(75, 0, 130, 0.7));
    animation: voucherSpin 6s linear infinite;
}

.signature {
    font-family: 'Dancing Script', cursive;
    font-size: 1.4rem;
    margin-top: 15px;
    text-align: right;
    display: block;
}

.guild-seal {
    width: 60px;
    height: 60px;
    background: #8b0000;
    border-radius: 50%;
    margin: 15px auto 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #daa520;
    font-size: 1.5rem;
    box-shadow: 0 0 10px rgba(0,0,0,0.3);
}

/* Chat Class Icons */
.chat-class-icon {
    display: inline-flex;
    width: 18px;
    height: 18px;
    background: #333;
    border-radius: 4px;
    align-items: center;
    justify-content: center;
    margin-right: 5px;
    vertical-align: middle;
    font-size: 0.7rem;
}

.badge-calendared {
    background: var(--stat-green) !important;
}

/* Rumors Images */
.rumor-poster {
    width: 100%;
    border-radius: 10px;
    margin-top: 15px;
    border: 2px solid var(--accent-gold);
    display: block;
}

/* V4.18.17b : D20 ICOSAÈDRE (vrai D&D) — 20 faces triangulaires en CSS 3D */
#css-dice-container {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(ellipse at center, rgba(20,15,5,0.92) 0%, rgba(0,0,0,0.98) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 5000;
    perspective: 800px;
    perspective-origin: 50% 40%;
    font-family: 'Cinzel', serif;
    overflow: visible;
}

.dice-scene {
    position: relative;
    width: 220px;
    height: 220px;
    margin-bottom: 50px;
    perspective: 800px;
    overflow: visible;
}

#css-cube-el {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    /* Pas de transform initial — l'animation JS gère la rotation 3D */
}
#css-cube-el > svg {
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* V4.18.18c : animation 3D gérée en JS via _d20anim.project() — pas de CSS animation */
.dice-rolling { /* no-op */ }

@keyframes spinRoll {
    0%   { transform: rotateX(0deg)   rotateY(0deg)   rotateZ(0deg); }
    100% { transform: rotateX(1080deg) rotateY(720deg) rotateZ(360deg); }
}

/* V4.18.18c : D20 ICOSAÈDRE via SVG 2D — pas de clip-path, juste un SVG qui contient 20 polygones */
/* L'ancienne classe .d20-face n'est plus utilisée, mais on la garde vide pour éviter les conflits */
.d20-face { display: none; }

/* Sol / ombre */
.dice-shadow {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 160px;
    height: 28px;
    background: radial-gradient(ellipse, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 70%);
    border-radius: 50%;
    filter: blur(3px);
    animation: shadowPulse 1.6s ease-in-out infinite;
}

@keyframes shadowPulse {
    0%, 100% { width: 160px; opacity: 0.7; }
    50% { width: 110px; opacity: 0.45; }
}

/* Score affiché en gros */
#dice-result-fixed {
    position: absolute;
    bottom: 12%;
    width: 100%;
    text-align: center;
    font-family: 'Cinzel Decorative', 'Cinzel', serif;
    color: #ffd700;
    font-size: 5.5rem;
    font-weight: 900;
    text-shadow:
        0 0 30px rgba(255,215,0,0.9),
        0 0 60px rgba(255,180,50,0.5),
        0 4px 8px rgba(0,0,0,0.8);
    display: none;
    animation: resultAppear 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    z-index: 10;
}

@keyframes resultAppear {
    0%   { transform: scale(0.2) rotate(-20deg); opacity: 0; }
    60%  { transform: scale(1.35) rotate(8deg); opacity: 1; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* Sparkles qui apparaissent avec le résultat */
.dice-sparkle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #ffd700;
    border-radius: 50%;
    pointer-events: none;
    box-shadow: 0 0 10px #ffd700, 0 0 20px #ff8c00;
    animation: sparkleFly 1.2s ease-out forwards;
}

@keyframes sparkleFly {
    0% { transform: translate(0, 0) scale(0); opacity: 1; }
    50% { opacity: 1; }
    100% { transform: translate(var(--tx), var(--ty)) scale(1.2); opacity: 0; }
}

/* V4.18.16 : "Flash" radial qui pulse au moment de la révélation */
.dice-flash {
    position: absolute;
    width: 300px;
    height: 300px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(255,215,0,0.6) 0%, rgba(255,215,0,0) 70%);
    border-radius: 50%;
    pointer-events: none;
    animation: diceFlash 0.8s ease-out forwards;
}

@keyframes diceFlash {
    0% { transform: translate(-50%, -50%) scale(0.3); opacity: 0; }
    30% { opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1.6); opacity: 0; }
}

/* V4.18.16 : Responsive dice — plus petit sur mobile */
@media (max-width: 380px) {
    .dice-scene { width: 140px; height: 140px; }
    .d20-face { width: 140px; height: 140px; font-size: 4rem; }
    .face-1 { transform: translateZ(70px); }
    .face-2 { transform: rotateY(90deg)  translateZ(70px); }
    .face-3 { transform: rotateY(180deg) translateZ(70px); }
    .face-4 { transform: rotateY(-90deg) translateZ(70px); }
    .face-5 { transform: rotateX(90deg)  translateZ(70px); }
    .face-6 { transform: rotateX(-90deg) translateZ(70px); }
    .dice-shadow { width: 120px; }
    #dice-result-fixed { font-size: 4.5rem; }
}

/* Sous-titre pendant le roll */
.dice-label {
    position: absolute;
    top: 12%;
    width: 100%;
    text-align: center;
    font-family: 'Cinzel', serif;
    color: #ffd700;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 4px;
    text-transform: uppercase;
    text-shadow: 0 2px 6px rgba(0,0,0,0.8), 0 0 20px rgba(255,215,0,0.3);
    animation: diceLabelPulse 1s ease-in-out infinite;
}

@keyframes diceLabelPulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; text-shadow: 0 2px 6px rgba(0,0,0,0.8), 0 0 30px rgba(255,215,0,0.6); }
}

/* V4.18.16 : "D20" branding en haut à droite (watermark) */
.dice-brand {
    position: absolute;
    top: 14%;
    right: 20px;
    font-family: 'Cinzel Decorative', 'Cinzel', serif;
    color: #ffd700;
    font-size: 0.85rem;
    font-weight: 900;
    letter-spacing: 2px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    opacity: 0.6;
}

/* V4.18.17 : Duel dice — icosaèdres mini (côte à côte) */
.duel-dice-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.duel-dice-label {
    font-family: 'MedievalSharp', 'Cinzel', serif;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
}
.duel-dice-scene {
    position: relative;
    width: 100px;
    height: 100px;
    perspective: 600px;
}
#duel-dice-mine, #duel-dice-opp {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateX(-20deg) rotateY(25deg);
}
.duel-dice-rolling {
    animation: duelDiceSpin 1s linear infinite;
}
@keyframes duelDiceSpin {
    0%   { transform: rotateX(0deg)   rotateY(0deg); }
    100% { transform: rotateX(720deg) rotateY(540deg); }
}
.duel-d-face {
    position: absolute;
    left: 50%;
    top: 50%;
    background:
        radial-gradient(circle at 35% 25%, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0) 50%),
        radial-gradient(circle at 70% 80%, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0) 55%),
        linear-gradient(135deg, #e8c66a 0%, #b8860b 40%, #8b4513 80%, #5c2e0a 100%);
    clip-path: polygon(50% 0%, 93.3% 75%, 6.7% 75%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'MedievalSharp', 'Cinzel Decorative', serif;
    font-weight: 900;
    font-size: 0.75rem;
    color: #fff8dc;
    text-shadow:
        0 0 2px #000,
        0 2px 0 #5c2e0a,
        0 3px 4px rgba(0,0,0,0.8),
        0 0 8px rgba(255,215,0,0.5);
    filter: drop-shadow(0 0 1px #000) drop-shadow(0 0 4px rgba(255,180,50,0.3));
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}
/* Adversaire dice en rouge */
#duel-dice-opp .duel-d-face {
    background:
        radial-gradient(circle at 35% 25%, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0) 50%),
        radial-gradient(circle at 70% 80%, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0) 55%),
        linear-gradient(135deg, #d4a574 0%, #8b1a1a 40%, #5a0a0a 80%, #2a0505 100%);
}
.duel-d-shadow {
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 90px;
    height: 14px;
    background: radial-gradient(ellipse, rgba(0,0,0,0.5) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(2px);
    animation: shadowPulse 1s ease-in-out infinite;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 2.2rem;
    color: #888;
    cursor: pointer;
    line-height: 0.8;
    z-index: 100;
    transition: color 0.2s, transform 0.2s;
}

.modal-close:hover {
    color: var(--accent-gold);
    transform: scale(1.1);
}

/* Onboarding & Modal Inputs Overhaul V4.11 */
.modal-panel input, 
#ob-char-name, 
#rec-email-input, 
#rec-code-input {
    width: calc(100% - 20px) !important;
    display: block !important;
    margin: 15px auto !important;
    padding: 12px !important;
    font-size: 1rem !important;
    border-radius: 8px !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
    background: rgba(0,0,0,0.3) !important;
    color: white !important;
}

/* Intendant modal : flex row layout overrides the block rule above */
#intendant-modal .intendant-field-group {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    margin-top: 4px !important;
}
#intendant-modal .intendant-field-group input {
    display: block !important;
    width: auto !important;
    flex: 1 !important;
    margin: 0 !important;
    background: rgba(0,0,0,0.5) !important;
    border: 1px solid #555 !important;
    color: #fff !important;
    padding: 10px 12px !important;
    border-radius: 8px !important;
    font-size: 0.9rem !important;
}
.btn-edit-field {
    flex-shrink: 0 !important;
    width: 22px !important;
    min-width: 22px !important;
    height: 22px;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0.65rem !important;
}

/* V4.6.1 : Bon de guilde = parchemin médiéval en plein */
@keyframes voucherSpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
.voucher-paper .voucher-item,
.voucher-item {
    color: #4a3121;
    font-family: 'Georgia', serif;
    font-size: 1.6rem;
    font-weight: 900;
    text-shadow: 1px 1px 0 rgba(255, 240, 200, 0.6);
    margin: 0;
    line-height: 1.2;
    padding: 0 20px;
    width: 100%;
    text-align: center;
}
.voucher-paper .voucher-ts,
.voucher-ts {
    color: #6b4423;
    font-size: 0.78rem;
    font-weight: 700;
    margin-top: 8px;
    text-shadow: 0 0 4px rgba(255, 230, 180, 0.5);
    padding: 0 25px;
    line-height: 1.3;
    width: 100%;
    text-align: center;
}
.voucher-ts-date {
    font-size: 0.72rem;
    font-weight: 600;
    margin-top: 2px;
    opacity: 0.85;
}

/* V4.18.9 : Sac sans cadre, juste l'image */
.bag-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    transition: transform 0.2s;
}
.bag-slot:hover { transform: scale(1.05); }
.bag-slot:active { transform: scale(0.95); }

/* V4.18.10 : NOTIFICATIONS UNIFORMISÉES (tab + buttons) — top-right, rondes, mêmes dim/police */
/* V4.18.16 : petit coup à droite supplémentaire (encore un peu plus loin de l'icône) */
/* V4.18.17 : suppression du contour noir (uniformisé avec le style des notifs dans les rumeurs) */
#hero-tab-badge, #tavern-tab-badge, #quests-tab-badge, #merchants-tab-badge, #header-title-badge {
    position: absolute;
    top: -2px;
    right: calc(50% - 30px);
    background: #e74c3c;
    color: white;
    font-size: 0.65rem;
    font-weight: 900;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    width: 18px;
    height: 18px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(231,76,60,0.6), 0 0 8px rgba(231,76,60,0.5);
    z-index: 30;
    line-height: 1;
    animation: badgePulse 1.8s ease-in-out infinite;
    pointer-events: none;
    text-align: center;
}
/* Si 2 chiffres, on élargit juste un peu (mais reste rond tant qu'on est <=2 digits) */
#hero-tab-badge[data-double], #tavern-tab-badge[data-double], #quests-tab-badge[data-double], #merchants-tab-badge[data-double] {
    width: 22px;
    border-radius: 11px;
    right: calc(50% - 32px);
}
@keyframes badgePulse {
    0%, 100% { transform: scale(1); box-shadow: 0 2px 8px rgba(231,76,60,0.6); }
    50%      { transform: scale(1.15); box-shadow: 0 2px 12px rgba(231,76,60,0.9); }
}

/* V4.18.8 : Intendant — sections bien séparées */
.intendant-section {
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    text-align: left;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}
.intendant-section-title {
    font-size: 0.7rem;
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 800;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(212,175,55,0.2);
    display: flex;
    align-items: center;
    gap: 8px;
}
.intendant-field {
    margin-bottom: 12px;
}
.intendant-field:last-child { margin-bottom: 0; }
.intendant-field label {
    display: block;
    font-size: 0.65rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
    font-weight: 700;
}
.intendant-field-row {
    display: flex;
    gap: 8px;
    align-items: center;
    max-width: 100%;
}
.intendant-field input {
    flex: 1;
    min-width: 0;
    background: rgba(0,0,0,0.5);
    border: 1px solid #444;
    color: #fff;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
}
.intendant-field input:focus {
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 2px rgba(212,175,55,0.2);
}
.intendant-action {
    width: 100%;
    margin-bottom: 8px;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-start;
    padding: 12px 15px;
}
.intendant-action:last-child { margin-bottom: 0; }
.intendant-action i { color: var(--accent-gold); width: 18px; text-align: center; }

.intendant-section-mode {
    background: rgba(139, 0, 0, 0.12);
    border-color: rgba(139, 0, 0, 0.4);
}
.intendant-section-mode .intendant-section-title {
    color: #e74c3c;
    border-bottom-color: rgba(231,76,60,0.3);
}
.intendant-mode-desc {
    font-size: 0.7rem;
    color: #aaa;
    line-height: 1.45;
    margin-bottom: 15px;
}
.intendant-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
    color: #ccc;
    user-select: none;
}
.intendant-toggle input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.intendant-toggle-slider {
    position: relative;
    width: 42px;
    height: 22px;
    background: #333;
    border: 1px solid #555;
    border-radius: 11px;
    transition: background 0.2s;
    flex-shrink: 0;
}
.intendant-toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #888;
    border-radius: 50%;
    transition: all 0.2s;
}
.intendant-toggle input:checked + .intendant-toggle-slider {
    background: #8b0000;
    border-color: #c0392b;
}
.intendant-toggle input:checked + .intendant-toggle-slider::before {
    left: 22px;
    background: #e74c3c;
}

.onboarding-step .btn {
    background: linear-gradient(135deg, #daa520, #4a3121) !important;
    border: 2px solid var(--accent-gold) !important;
    color: black !important;
    font-weight: 800 !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4) !important;
}

#rumors-list .rumor-card {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.onboarding-link {
    color: var(--text-dim);
    font-size: 0.8rem;
    text-decoration: underline;
    cursor: pointer;
    display: block;
    margin-top: 15px;
}

/* Animations Bon Taverne V4.17 */
@keyframes shake {
  0% { transform: translate(1px, 1px) rotate(0deg); }
  10% { transform: translate(-1px, -2px) rotate(-1deg); }
  20% { transform: translate(-3px, 0px) rotate(1deg); }
  30% { transform: translate(3px, 2px) rotate(0deg); }
  40% { transform: translate(1px, -1px) rotate(1deg); }
  50% { transform: translate(-1px, 2px) rotate(-1deg); }
  60% { transform: translate(-3px, 1px) rotate(0deg); }
  70% { transform: translate(3px, 1px) rotate(-1deg); }
  80% { transform: translate(-1px, -1px) rotate(1deg); }
  90% { transform: translate(1px, 2px) rotate(0deg); }
  100% { transform: translate(1px, -2px) rotate(-1deg); }
}
.shake { animation: shake 0.5s; animation-iteration-count: infinite; }
@keyframes pulseColor {
    0% { color: #8b4513; text-shadow: 0 0 5px rgba(212,175,55,0.2); }
    50% { color: #d4af37; text-shadow: 0 0 15px rgba(212,175,55,1); }
    100% { color: #8b4513; text-shadow: 0 0 5px rgba(212,175,55,0.2); }
}
.animated-timestamp {
    animation: pulseColor 3s infinite ease-in-out;
    display: inline-block;
}
@keyframes spinSeal {
    100% { transform: rotate(360deg); }
}
.guild-seal {
    animation: spinSeal 10s linear infinite;
    display: inline-block;
}

/* QR Code Container Styling V4.18.2 */
#duel-qr-container, #quest-qr-container {
    background: #fff; /* Keep white for QR readability */
    padding: 12px;
    border-radius: 15px;
    border: 3px solid var(--accent-gold);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
    margin: 10px auto 20px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Fix for the "Beige Bar" appearance - ensure panel doesn't look like a bar */
#duel-modal .modal-panel, #quest-qr-modal .modal-panel {
    padding: 40px 20px 25px;
    border-radius: 20px;
}

/* RPG Interactive Tutorial & BD Speech Bubble Overlay */
#rpg-tutorial-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: transparent;
    z-index: 999997 !important;
    pointer-events: auto;
    transition: opacity 0.3s ease;
    display: none;
}
#tuto-spotlight {
    position: absolute;
    z-index: 999995 !important;
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.8), inset 0 0 15px rgba(0,0,0,0.6);
    border: 3px solid var(--accent-gold);
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.25, 1, 0.5, 1);
    background: transparent;
    border-radius: 12px;
    display: none;
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.8), 0 0 15px var(--accent-gold);
}
.tuto-highlight {
    position: relative;
    z-index: 999996 !important;
    pointer-events: none !important; /* Block all clicks during the tutorial steps */
}
.tuto-bubble {
    position: fixed;
    background: #0f172a;
    border: 2px solid var(--accent-gold);
    border-radius: 16px;
    padding: 14px 16px;
    width: 290px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.95), 0 0 15px rgba(212,175,55,0.3);
    z-index: 999999 !important;
    color: #f1f5f9;
    font-size: 0.84rem;
    line-height: 1.45;
    transition: all 0.35s cubic-bezier(0.25, 1, 0.5, 1);
    font-family: system-ui, -apple-system, sans-serif;
    text-align: left;
}
/* BD speech bubble arrows */
.tuto-bubble::after {
    content: '';
    position: absolute;
    width: 0; height: 0;
    border-style: solid;
}
.tuto-arrow-up::after {
    top: -12px; left: 50%; transform: translateX(-50%);
    border-width: 0 12px 12px 12px;
    border-color: transparent transparent #111e2d transparent;
}
.tuto-arrow-up-gold::before {
    content: ''; position: absolute; top: -15px; left: 50%; transform: translateX(-50%);
    border-width: 0 13px 13px 13px; border-color: transparent transparent var(--accent-gold) transparent;
    z-index: -1;
}
.tuto-arrow-down::after {
    bottom: -12px; left: 50%; transform: translateX(-50%);
    border-width: 12px 12px 0 12px;
    border-color: #111e2d transparent transparent transparent;
}
.tuto-arrow-down-gold::before {
    content: ''; position: absolute; bottom: -15px; left: 50%; transform: translateX(-50%);
    border-width: 13px 13px 0 13px; border-color: var(--accent-gold) transparent transparent transparent;
    z-index: -1;
}
.tuto-header {
    font-family: 'Cinzel', serif;
    color: var(--accent-gold);
    font-size: 0.9rem;
    font-weight: bold;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(212,175,55,0.25);
    padding-bottom: 5px;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.tuto-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    gap: 8px;
}
.tuto-btn-skip {
    font-size: 0.72rem;
    color: #aaa;
    background: transparent;
    border: none;
    cursor: pointer;
    text-decoration: underline;
    font-family: sans-serif;
}
.tuto-btn-skip:hover {
    color: #ef4444;
}
.tuto-btn-nav {
    background: var(--accent-gold);
    color: #111;
    border: none;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: bold;
    cursor: pointer;
    font-family: sans-serif;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}
.tuto-btn-nav-prev {
    background: #2c3e50;
    color: #eee;
}
.tuto-btn-nav:hover {
    filter: brightness(1.1);
}
@keyframes swing {
    0% { transform: rotate(-5deg); }
    100% { transform: rotate(5deg); }
}

/* Premium Custom Toggle Switch */
.premium-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 22px;
  flex-shrink: 0;
}
.premium-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.premium-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #2a2a2a;
  transition: .3s;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,0.08);
}
.premium-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: #888;
  transition: .3s;
  border-radius: 50%;
}
.premium-switch input:checked + .premium-slider {
  background-color: var(--accent-gold);
  border-color: var(--accent-gold);
}
.premium-switch input:checked + .premium-slider:before {
  transform: translateX(22px);
  background-color: #111;
}


