:root {
    --evr-top: 56px;            /* hauteur de la barre AK66 en haut */
    --bg: #1a0b0b;              /* void foncé */
    --panel: #220f0f;           /* --void du site */
    --panel-light: #2c1414;     /* --void-2 du site */
    --border: rgba(247, 241, 230, 0.12);
    --text: #f7f1e6;            /* --cream */
    --text-dim: #b9a89c;
    --accent: #d62839;          /* --red */
    --accent-light: #ff6b35;    /* --ember */
    --gold: #f4b740;            /* --gold */
    --raise: #ef4444;
    --call: #22c55e;
    --bluff: #06b6d4;
    --tight: #f59e0b;
    --loose: #8b5cf6;
    --allin: #ec4899;
    --green: #f4b740;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { 
    background-color: var(--bg); 
    background-image: radial-gradient(circle at top right, #1a0a14, transparent 60%), radial-gradient(circle at bottom left, #0c0608, transparent 60%);
    color: var(--text); font-family: 'Manrope', sans-serif; display: flex; min-height: 100vh; overflow: hidden; 
}

/* Les couleurs ci-dessus reprennent la charte du site AK66 ; layout et polices : ak66-theme.css */

/* --- SIDEBAR --- */
.sidebar { background: rgba(34, 15, 15, 0.94); backdrop-filter: blur(12px); width: 320px; padding: 20px; border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 15px; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 900; font-size: 18px; letter-spacing: -0.5px; text-transform: uppercase; margin-bottom: 10px; color: var(--text); }
.brand-icon { width: 34px; height: 34px; background: linear-gradient(135deg, var(--accent), var(--accent-light)); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: white; font-weight: bold; font-size: 18px; box-shadow: 0 4px 15px rgba(214, 40, 57, 0.4); }

.widget { background: var(--panel-light); padding: 15px; border-radius: 10px; border: 1px solid var(--border); box-shadow: 0 4px 6px rgba(0,0,0,0.2); }
.widget h3 { font-size: 10px; color: var(--text-dim); text-transform: uppercase; margin-bottom: 10px; letter-spacing: 1.5px; font-weight: 700; }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 15px; }
.stat-box { background: var(--bg); padding: 10px; border-radius: 8px; text-align: center; border: 1px solid var(--border); }
.stat-value { font-size: 20px; font-weight: 700; color: var(--text); }
.stat-label { font-size: 10px; color: var(--text-dim); margin-top: 2px; text-transform: uppercase; }

input[type="range"] { width: 100%; accent-color: var(--accent); height: 5px; }
.slider-container { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.slider-val { font-weight: 700; color: var(--green); min-width: 40px; text-align: right; font-size: 13px; }
.btn { width: 100%; padding: 10px; background: var(--accent); color: white; border: none; border-radius: 8px; font-weight: 600; cursor: pointer; transition: 0.2s; font-size: 13px; }
.btn:hover { background: var(--accent-light); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(214, 40, 57, 0.3); }
.btn-gray { background: #3a1c1c; } .btn-gray:hover { background: #4a2424; box-shadow: none; } 
.btn-green { background: var(--green); } .btn-danger { background: var(--raise); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent-light); background: transparent; box-shadow: none; }

.tool-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tool-btn { padding: 12px; border: 1px solid transparent; border-radius: 8px; cursor: pointer; color: white; font-weight: 600; font-size: 12px; background: #3a1c1c; transition: 0.15s; display: flex; align-items: center; justify-content: center; gap: 6px; }
.tool-btn:hover { opacity: 0.9; }
.tool-btn.active { border-color: white; box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px white; }
.t-raise { background: var(--raise); } .t-call { background: var(--call); }
.t-bluff { background: var(--bluff); } .t-erase { background: #4a2a2a; }
.t-tight { background: var(--tight); } .t-loose { background: var(--loose); } .t-allin { background: var(--allin); }

.explorer-widget { flex: 1; display: flex; flex-direction: column; min-height: 150px; overflow: hidden; }
.explorer-toolbar { display: flex; gap: 5px; margin-bottom: 10px; align-items: center; }
.icon-btn { background: #3a1c1c; color: var(--text); border: none; padding: 10px; border-radius: 6px; cursor: pointer; font-size: 14px; flex: 1; transition: 0.2s; }
.icon-btn:hover { background: #4a2424; }
.icon-btn.danger:hover { background: var(--raise); }
.color-picker-input { width: 38px; height: 38px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; cursor: pointer; padding: 2px; }
.range-input { width: 100%; padding: 10px; margin-bottom: 10px; background: var(--bg); border: 1px solid var(--border); color: white; border-radius: 8px; font-size: 13px; font-family: inherit; }
.range-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(214, 40, 57, 0.2); }

.tree-container { flex: 1; overflow-y: auto; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px; }
::-webkit-scrollbar { width: 6px; height: 6px; } ::-webkit-scrollbar-track { background: transparent; } ::-webkit-scrollbar-thumb { background: #3a1c1c; border-radius: 3px; }

.tree-item { display: flex; align-items: center; padding: 8px; border-radius: 6px; cursor: pointer; gap: 8px; font-size: 13px; user-select: none; position: relative; transition: 0.1s; }
.tree-item:hover { background: rgba(255,255,255,0.05); }
.tree-item.selected { background: rgba(214, 40, 57, 0.2); color: var(--accent-light); box-shadow: inset 2px 0 0 var(--accent-light); }
.tree-item .toggle { width: 12px; text-align: center; font-size: 10px; opacity: 0.5; }
.tree-item .color-dot { width: 10px; height: 10px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.1); }
.tree-item.drag-over-inside { outline: 2px solid var(--accent-light); outline-offset: -2px; background: rgba(214, 40, 57, 0.2); }
.tree-item.drop-before::before { content: ''; position: absolute; top: -1px; left: 0; right: 0; height: 2px; background: var(--accent-light); }
.tree-item.drop-after::after { content: ''; position: absolute; bottom: -1px; left: 0; right: 0; height: 2px; background: var(--accent-light); }

/* --- MAIN CONTENT --- */
.main-content { flex: 1; padding: 25px; display: flex; flex-direction: column; align-items: center; overflow-y: auto; height: 100vh; }
.header-bar { display: flex; justify-content: space-between; align-items: center; width: 100%; max-width: 1200px; margin-bottom: 25px; gap: 20px; flex-wrap: wrap; }
.view-toggle { display: flex; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 4px; }
.view-btn { padding: 8px 16px; border: none; background: transparent; color: var(--text-dim); border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 13px; transition: 0.2s; }
.view-btn.active { background: var(--accent); color: white; box-shadow: 0 2px 8px rgba(214, 40, 57, 0.3); }

.search-bar { position: relative; display: flex; align-items: center; flex: 1; max-width: 250px; }
.search-bar input { background: var(--panel); border: 1px solid var(--border); color: var(--text); padding: 8px 12px 8px 36px; border-radius: 8px; font-family: inherit; width: 100%; font-size: 13px; }
.search-bar input:focus { outline: none; border-color: var(--accent); }
.search-bar svg { position: absolute; left: 12px; color: var(--text-dim); pointer-events: none; }

.board-selector { display: flex; gap: 10px; align-items: center; }
.card-slot { width: 48px; height: 65px; border: 2px dashed var(--border); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 700; cursor: pointer; background: var(--panel); transition: 0.2s; }
.card-slot:hover { border-color: var(--accent-light); }
.card-slot.has-card { border-style: solid; background: white; box-shadow: 0 4px 10px rgba(0,0,0,0.5); }
.card-slot.red { color: #dc2626; } .card-slot.black { color: #111827; }

/* --- POKER GRID --- */
.range-grid { display: grid; grid-template-columns: repeat(13, 1fr); gap: 3px; background: var(--border); padding: 3px; border-radius: 12px; user-select: none; box-shadow: 0 20px 50px rgba(0,0,0,0.5), 0 0 0 1px rgba(214, 40, 57, 0.1); }
.cell { background: var(--panel-light); width: 55px; height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; color: #cdbcb4; cursor: pointer; border-radius: 6px; transition: transform 0.1s, box-shadow 0.1s; position: relative; overflow: hidden; }
.cell:hover { transform: scale(1.1); z-index: 10; box-shadow: 0 0 15px rgba(255, 107, 53, 0.3); }
.cell.blocked { opacity: 0.15; pointer-events: none; text-decoration: line-through; background: #000; }
.cell.dimmed { opacity: 0.1; }
.combo-count { font-size: 9px; font-weight: 600; opacity: 0.9; margin-top: 2px; position: absolute; bottom: 2px; z-index: 2; }
/* FIX export PNG : html2canvas ignore le z-index d'un élément non positionné,
   l'overlay coloré passait donc par-dessus le texte */
.cell-text { position: relative; z-index: 2; text-shadow: 0 1px 2px rgba(0,0,0,0.5); }
.cell-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; }

/* --- DETAILED STATS --- */
.detailed-stats { width: 100%; max-width: 740px; margin-top: 20px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 15px; display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; }
.ds-box { flex: 1; min-width: 80px; background: var(--bg); padding: 12px; border-radius: 8px; text-align: center; border-bottom: 3px solid var(--border); }
.ds-box .ds-label { font-size: 10px; color: var(--text-dim); text-transform: uppercase; margin-bottom: 5px; font-weight: 700; letter-spacing: 1px; }
.ds-box .ds-val { font-size: 16px; font-weight: 700; }
.ds-box.raise { border-color: var(--raise); } .ds-box.raise .ds-val { color: var(--raise); }
.ds-box.call { border-color: var(--call); } .ds-box.call .ds-val { color: var(--call); }
.ds-box.bluff { border-color: var(--bluff); } .ds-box.bluff .ds-val { color: var(--bluff); }
.ds-box.tight { border-color: var(--tight); } .ds-box.tight .ds-val { color: var(--tight); }
.ds-box.loose { border-color: var(--loose); } .ds-box.loose .ds-val { color: var(--loose); }
.ds-box.allin { border-color: var(--allin); } .ds-box.allin .ds-val { color: var(--allin); }
.ds-box.fold { border-color: #475569; } .ds-box.fold .ds-val { color: #94a3b8; }
.ds-box.total { border-color: var(--accent); } .ds-box.total .ds-val { color: var(--accent-light); }

.detailed-stats.small { max-width: 100%; padding: 10px; gap: 5px; }
.detailed-stats.small .ds-box { padding: 8px; min-width: 60px; }
.detailed-stats.small .ds-label { font-size: 8px; margin-bottom: 2px; }
.detailed-stats.small .ds-val { font-size: 12px; }

/* --- COMPARE MODE --- */
.compare-container { display: flex; gap: 40px; width: 100%; justify-content: center; flex-wrap: nowrap; }
.compare-col { display: flex; flex-direction: column; align-items: center; gap: 15px; width: 100%; max-width: 600px; }
.compare-select { width: 100%; padding: 8px; background: var(--panel); border: 1px solid var(--border); color: var(--text); border-radius: 6px; font-family: inherit; }
.range-grid.small .cell { width: 100%; height: 35px; font-size: 11px; }
.range-grid.small .combo-count { font-size: 7px; }

@media (max-width: 1200px) {
    .compare-container { flex-direction: column; align-items: center; }
}

/* --- MODALS --- */
#toast { position: fixed; bottom: 20px; right: 20px; background: var(--accent); color: white; padding: 12px 24px; border-radius: 8px; display: none; font-weight: 600; z-index: 1000; box-shadow: 0 4px 15px rgba(214, 40, 57, 0.5); }
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85); backdrop-filter: blur(8px); display: none; align-items: center; justify-content: center; z-index: 100; }
.modal { background: var(--panel); padding: 24px; border-radius: 12px; width: 450px; border: 1px solid var(--border); box-shadow: 0 20px 50px rgba(0,0,0,0.5), 0 0 0 1px rgba(214, 40, 57, 0.2); }
.modal h3 { margin-bottom: 15px; font-size: 18px; color: var(--text); } .modal p { font-size: 12px; color: var(--text-dim); margin-bottom: 10px; }
.modal textarea { width: 100%; height: 100px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 10px; padding: 10px; font-family: inherit; resize: none; }

.freq-row { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; }
.freq-label { width: 60px; font-weight: 600; font-size: 14px; }
.freq-slider { flex: 1; accent-color: var(--accent); }
.freq-val { width: 40px; text-align: right; font-weight: 700; }
.freq-preview { width: 100%; height: 50px; border-radius: 8px; border: 1px solid var(--border); margin-bottom: 15px; display: flex; align-items: center; justify-content: center; font-weight: bold; }

/* --- CARD PICKER MODAL --- */
.card-picker-grid { display: grid; grid-template-columns: repeat(13, 1fr); gap: 4px; margin-top: 10px; }
.picker-card { aspect-ratio: 2/3; background: white; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; cursor: pointer; transition: 0.1s; }
.picker-card:hover { transform: scale(1.1); box-shadow: 0 0 8px var(--accent-light); }
.picker-card.used { opacity: 0.1; pointer-events: none; }
.picker-card.red { color: #dc2626; } .picker-card.black { color: #111827; }

/* --- AFFICHAGE COMBOS (toggle) --- */
body.hide-combos .combo-count { display: none; }

/* --- PANNEAU DES SAVES (droite, rétractable) --- */
.saves-panel { width: 300px; flex-shrink: 0; height: 100vh; padding: 20px; background: rgba(34, 15, 15, 0.94); backdrop-filter: blur(12px); border-left: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; transition: width 0.2s, padding 0.2s; }
.saves-panel > * { min-width: 260px; }
.saves-panel .explorer-widget { flex: 1; min-height: 0; }
body.saves-collapsed .saves-panel { width: 0; padding-left: 0; padding-right: 0; border-left-color: transparent; }
.saves-toggle { position: fixed; top: 50%; right: 300px; transform: translateY(-50%); z-index: 60; writing-mode: vertical-rl; background: var(--accent); color: white; border: none; padding: 14px 8px; border-radius: 8px 0 0 8px; cursor: pointer; font-weight: 700; font-size: 12px; transition: right 0.2s; }
.saves-toggle:hover { background: var(--accent-light); }
body.saves-collapsed .saves-toggle { right: 0; }

/* --- BADGE MODE DE STOCKAGE --- */
#storage-badge { float: right; font-size: 9px; padding: 2px 8px; border-radius: 10px; letter-spacing: 0.5px; cursor: help; }
#storage-badge.server { background: rgba(16, 185, 129, 0.2); color: #10b981; }
#storage-badge.local { background: rgba(245, 158, 11, 0.2); color: #f59e0b; }

/* --- OUTILS : pinceau, undo, actions --- */
.brush-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: 11px; color: var(--text-dim); }
#brush-freqs { display: flex; gap: 4px; }
.chip { background: #3a1c1c; color: var(--text-dim); border: 1px solid transparent; border-radius: 6px; padding: 4px 7px; font-size: 11px; font-weight: 600; cursor: pointer; transition: 0.15s; }
.chip:hover { color: var(--text); }
.chip.active { background: var(--accent); color: white; }
.tool-row { display: flex; gap: 8px; margin-top: 8px; }
.tool-row .btn { padding: 8px; font-size: 12px; }
.tool-btn.t-add { background: transparent; border: 1px dashed var(--border); color: var(--text-dim); }
.tool-btn.t-add:hover { border-color: var(--accent-light); color: var(--accent-light); }

/* --- MODALE ACTIONS --- */
.action-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.action-row .range-input { margin-bottom: 0; flex: 1; }
.action-row .icon-btn { flex: 0 0 38px; padding: 9px 0; }
.act-lock { width: 38px; text-align: center; color: var(--text-dim); font-size: 8px; opacity: 0.5; }
#actions-list { max-height: 45vh; overflow-y: auto; margin-bottom: 12px; padding-right: 4px; }
.action-add { display: flex; align-items: center; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.action-add .range-input { margin-bottom: 0; flex: 1; }
.action-add .btn { width: auto; padding: 10px 14px; }

/* --- ARBORESCENCE MODERNE --- */
.tree-tools { display: flex; gap: 5px; margin-bottom: 8px; }
.tree-tools .range-input { margin-bottom: 0; flex: 1; padding: 8px 10px; font-size: 12px; }
.tree-tools .icon-btn { flex: 0 0 34px; padding: 0; }
.tree-container { padding: 6px; }
.tree-item { padding: 7px 8px; gap: 7px; margin-bottom: 1px; border-radius: 8px; border: 1px solid transparent; }
.tree-item.selected { background: rgba(214, 40, 57, 0.18); border-color: rgba(255, 107, 53, 0.35); box-shadow: none; color: var(--text); }
.tree-item.loaded .t-name { color: var(--accent-light); font-weight: 700; }
.tree-item .ico { flex: 0 0 16px; color: var(--text-dim); }
.tree-item.range:hover .ico, .tree-item.selected .ico { color: var(--accent-light); }
.chev { width: 12px; flex: 0 0 12px; font-size: 10px; text-align: center; opacity: 0.55; transition: transform 0.15s; display: inline-block; }
.chev.open { transform: rotate(90deg); }
.t-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-item.folder .t-name { font-weight: 600; }
.t-badge { flex: 0 0 auto; font-size: 10px; font-weight: 600; color: var(--text-dim); background: rgba(255, 255, 255, 0.06); padding: 1px 7px; border-radius: 10px; }
.t-bar { position: absolute; left: 27px; right: 8px; bottom: 2px; height: 2px; border-radius: 2px; opacity: 0.85; }
.tree-item.range { padding-bottom: 9px; }
.tree-children { margin-left: 13px; padding-left: 5px; border-left: 1px solid rgba(255, 255, 255, 0.08); }
.tree-empty { color: var(--text-dim); font-size: 12px; text-align: center; padding: 20px; line-height: 1.5; }
code { background: var(--bg); padding: 1px 5px; border-radius: 4px; color: var(--text); font-size: 11px; }

/* --- INTERRUPTEURS --- */
.switch-row { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-dim); margin-top: 10px; cursor: pointer; user-select: none; }
.switch-row:hover { color: var(--text); }
.switch-row input { display: none; }
.switch { width: 34px; height: 18px; flex: 0 0 34px; border-radius: 10px; background: #3a1c1c; position: relative; transition: 0.2s; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #cdbcb4; transition: 0.2s; }
.switch-row input:checked + .switch { background: var(--accent); }
.switch-row input:checked + .switch::after { left: 18px; background: white; }

/* --- GRILLE ALLÉGÉE : plus de s/o, zones suited / offsuit / paires teintées --- */
body.lite-grid .sfx { display: none; }
body.lite-grid .cell.suited { background: #2e1717; }
body.lite-grid .cell.offsuit { background: #160a0a; }
body.lite-grid .cell.pair { background: #3d2020; }
body.lite-grid .cell.blocked { background: #000; }
.lite-legend { display: none; gap: 12px; margin-top: 8px; font-size: 10px; color: var(--text-dim); }
body.lite-grid .lite-legend { display: flex; }
.lite-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; border: 1px solid rgba(255, 255, 255, 0.15); }

/* --- STATS VERTICALES À DROITE DE LA GRILLE --- */
#builder-view { display: flex; align-items: flex-start; gap: 20px; }
.detailed-stats.vertical { flex: 0 0 165px; width: 165px; max-width: none; margin-top: 0; padding: 10px; gap: 8px; flex-direction: column; flex-wrap: nowrap; justify-content: flex-start; max-height: calc(100vh - 150px); overflow-y: auto; }
.detailed-stats.vertical .ds-box { flex: 0 0 auto; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left; padding: 10px 12px; border-bottom: 0; border-left: 3px solid var(--border); }
.detailed-stats.vertical .ds-label { margin-bottom: 0; }

/* =====================================================================
   RESPONSIVE
   ===================================================================== */
.quickbar, .drawer-backdrop { display: none; }
.range-grid { -webkit-touch-callout: none; }
@media (hover: none) { .cell:hover { transform: none; box-shadow: none; } }

/* Écrans moyens : les stats repassent sous la grille */
@media (max-width: 1380px) {
    #builder-view { flex-direction: column; align-items: center; }
    .detailed-stats.vertical { flex: none; width: 100%; max-width: 760px; flex-direction: row; flex-wrap: wrap; max-height: none; overflow: visible; }
    .detailed-stats.vertical .ds-box { flex: 1 1 90px; flex-direction: column; justify-content: center; gap: 0; text-align: center; border-left: 0; border-bottom: 3px solid var(--border); }
    .detailed-stats.vertical .ds-label { margin-bottom: 5px; }
}

/* Tablette / smartphone : sidebar et saves deviennent des tiroirs, barre d'actions en bas */
@media (max-width: 1100px) {
    body { display: block; overflow: auto; min-height: 100vh; padding-bottom: 80px; }
    .main-content { height: auto; overflow: visible; width: 100%; padding: 12px; }
    .header-bar { gap: 10px; margin-bottom: 12px; }
    .search-bar { max-width: none; flex: 1 1 140px; }
    .board-selector { gap: 6px; flex-wrap: wrap; }
    .card-slot { width: 36px; height: 50px; font-size: 17px; }

    .sidebar { position: fixed; top: 0; bottom: 0; left: 0; height: auto; width: min(330px, 88vw); z-index: 90; background: rgba(34, 15, 15, 0.98); transform: translateX(-100%); transition: transform 0.25s; }
    body.sidebar-open .sidebar { transform: none; }
    .saves-panel { position: fixed; top: 0; bottom: 0; right: 0; height: auto; width: min(330px, 88vw); z-index: 90; background: rgba(34, 15, 15, 0.98); transition: transform 0.25s; }
    .saves-panel > * { min-width: 0; }
    body.saves-collapsed .saves-panel { width: min(330px, 88vw); padding: 20px; border-left: 1px solid var(--border); transform: translateX(100%); }
    .saves-toggle { right: min(330px, 88vw); z-index: 95; }
    body.saves-collapsed .saves-toggle { right: 0; }
    .drawer-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); z-index: 85; }
    body.sidebar-open .drawer-backdrop, body:not(.saves-collapsed) .drawer-backdrop { display: block; }

    .quickbar { display: flex; align-items: center; gap: 6px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 80; padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px)); background: rgba(34, 15, 15, 0.96); border-top: 1px solid var(--border); backdrop-filter: blur(10px); }
    .qb-btn { flex: 0 0 auto; width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--border); background: #3a1c1c; color: var(--text); font-size: 18px; cursor: pointer; }
    .qb-actions { display: flex; gap: 6px; overflow-x: auto; flex: 1; scrollbar-width: none; }
    .qb-actions::-webkit-scrollbar { display: none; }
    .qb-actions .tool-btn { flex: 0 0 auto; height: 42px; padding: 0 14px; font-size: 12px; white-space: nowrap; }

    #builder-view { width: 100%; }
    .range-grid { width: 100%; grid-template-columns: repeat(13, minmax(0, 1fr)); gap: 2px; padding: 2px; border-radius: 8px; }
    .range-grid .cell { width: 100%; height: auto; aspect-ratio: 1 / 0.86; font-size: clamp(8px, 2.7vw, 13px); border-radius: 4px; }
    .range-grid.small .cell { height: auto; }
    .detailed-stats.vertical .ds-box { flex: 1 1 28%; padding: 8px; }
    .detailed-stats .ds-val { font-size: 14px; }

    .modal { width: 94vw !important; max-width: 460px; max-height: 88vh; overflow-y: auto; padding: 18px; }
    #toast { left: 12px; right: 12px; bottom: 88px; text-align: center; }
}

/* =====================================================================
   EXTRAS : sélections rapides, opérations, infos, quiz, équité, stats
   ===================================================================== */
.hint { font-size: 11px; color: var(--text-dim); margin-top: 8px; line-height: 1.4; }
.chip-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-wrap .chip { padding: 5px 9px; }
.widget select.compare-select { width: 100%; }
.widget .btn-outline { padding: 8px; }

/* Infos de range */
.meta-box { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); flex: 0 0 auto; }
.meta-box h3 { margin-bottom: 8px; }
.meta-box .range-input { margin-bottom: 6px; padding: 8px 10px; font-size: 12px; }
.meta-box textarea.range-input { resize: vertical; }
.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.t-meta { flex: 0 0 auto; font-size: 10px; color: var(--text-dim); opacity: 0.8; }

/* Badge / verrou */
#storage-badge.readonly { background: rgba(148, 163, 184, 0.2); color: #94a3b8; }
.auth-btn { float: right; margin-right: 6px; background: none; border: none; cursor: pointer; font-size: 13px; line-height: 1; padding: 0 2px; }
body.readonly #save-range-btn, body.readonly #new-folder-btn, body.readonly #rename-btn,
body.readonly #delete-btn, body.readonly #folder-color, body.readonly #manage-actions-btn { display: none; }

/* Heatmap tracker + différences */
.cell-heat { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.cell.diff-same { opacity: 0.3; }
.cell.diff-only { box-shadow: inset 0 0 0 2px #fbbf24; }
.cell.diff-change { box-shadow: inset 0 0 0 2px #38bdf8; }
.cell.diff-missing { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22); opacity: 0.55; }

/* Vue Compare : outils + équité */
#compare-view { flex-direction: column; align-items: center; gap: 14px; width: 100%; }
.compare-tools { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; max-width: 760px; }
.compare-tools .switch-row { margin-top: 0; }
.eq-box { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; color: var(--text-dim); font-size: 12px; }
.eq-box .compare-select { width: auto; min-width: 130px; }
.eq-box .btn { width: auto; padding: 9px 14px; }
.eq-result { text-align: center; font-size: 15px; min-height: 22px; }
.eq-result small { color: var(--text-dim); font-size: 11px; }

/* Quiz */
#quiz-view { width: 100%; justify-content: center; }
.quiz-card { width: 100%; max-width: 560px; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; align-items: center; gap: 14px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4); }
.quiz-top { display: flex; gap: 8px; width: 100%; }
.quiz-score { font-size: 12px; color: var(--text-dim); }
.quiz-context { text-align: center; font-size: 15px; line-height: 1.5; }
.quiz-context span { font-size: 12px; color: var(--text-dim); }
.quiz-hand { display: flex; gap: 12px; }
.qcard { width: 84px; height: 116px; background: #fff; border-radius: 10px; font-size: 46px; font-weight: 800; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5); }
.qcard.red { color: #dc2626; } .qcard.black { color: #111827; }
.quiz-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; width: 100%; }
.qz-btn { padding: 14px 20px; font-size: 14px; }
.qz-btn small { opacity: 0.7; font-weight: 500; }
.qz-btn:disabled { cursor: default; opacity: 0.45; }
.qz-btn.right { opacity: 1; outline: 2px solid #22c55e; outline-offset: 2px; }
.qz-btn.wrong { opacity: 1; outline: 2px solid #ef4444; outline-offset: 2px; }
.quiz-feedback { min-height: 22px; text-align: center; font-weight: 600; }
.quiz-feedback.ok { color: #22c55e; } .quiz-feedback.mix { color: #f59e0b; } .quiz-feedback.ko { color: #ef4444; }
.quiz-misses { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.qz-title { width: 100%; font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-dim); font-weight: 700; margin: 10px 0 6px; }
.modal .t-badge small { opacity: 0.7; }

@media (max-width: 1100px) {
    .qcard { width: 66px; height: 92px; font-size: 36px; }
    .qz-btn { flex: 1 1 40%; }
}
