:root {
  --bg: #0a0f1c;
  --panel: rgba(11, 16, 30, 0.94);
  --card: rgba(255, 255, 255, 0.035);
  --line: rgba(148, 163, 184, 0.2);
  --text: #e8edf6;
  --muted: #8b97ad;
  --green: #34d399;
  --yellow: #fbbf24;
  --red: #f43f5e;
  --orange: #fb923c;
  --mono: "Cascadia Mono", "SF Mono", Consolas, monospace;
  --title: "Arial Black", "Segoe UI Black", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.4 "Segoe UI", system-ui, sans-serif; overflow: hidden; }
#map { position: fixed; inset: 0; background: #aad3df; }
.leaflet-control-attribution, .maplibregl-ctrl-attrib { display: none !important; }

button { font: inherit; color: inherit; background: rgba(30, 41, 59, 0.85); border: 1px solid var(--line); border-radius: 10px; padding: 7px 12px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: transform 0.12s, background 0.15s, box-shadow 0.15s, border-color 0.15s; }
button:hover { background: rgba(51, 65, 85, 0.95); transform: translateY(-1px); }
button:active { transform: scale(0.94); }
button:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
button.primary { background: linear-gradient(135deg, #34d399, #10b981); color: #022c22; border-color: transparent; font-weight: 700; box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35); }
button.danger { background: linear-gradient(135deg, #f43f5e, #e11d48); border-color: transparent; font-weight: 600; }
input, textarea, select { font: inherit; color: var(--text); background: rgba(2, 6, 23, 0.6); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; width: 100%; transition: border-color 0.15s, box-shadow 0.15s; }
input:focus, textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.18); }
.ic { display: block; flex: none; }
.ic.fill { fill: currentColor; }

/* ---------- Barres flottantes ---------- */
#brand, #nav, #hud, #toolbar, #sale { position: fixed; z-index: 1000; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; backdrop-filter: blur(8px); box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35); }
#brand { top: 10px; left: 10px; display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 8px; letter-spacing: 0.5px; font-size: 17px; font-family: var(--title); }
#brand img { image-rendering: pixelated; animation: float 3.5s ease-in-out infinite; }
#brand span { background: linear-gradient(90deg, #34d399, #fbbf24); -webkit-background-clip: text; background-clip: text; color: transparent; }
@keyframes float { 50% { transform: translateY(-3px) rotate(6deg); } }

#sale { top: 70px; left: 10px; display: flex; align-items: center; gap: 14px; padding: 12px 22px 12px 12px; min-width: 290px; color: #fff; background: linear-gradient(90deg, #e5473b 0%, #ee5a30 55%, #f4731f 100%); border: 0; border-radius: 18px; backdrop-filter: none; text-align: left; box-shadow: 0 10px 30px rgba(238, 90, 48, 0.4); animation: pop 0.5s cubic-bezier(0.3, 1.6, 0.5, 1), salepulse 2.6s ease-in-out infinite 0.5s; }
#sale:hover { background: linear-gradient(90deg, #ea5044 0%, #f2643a 55%, #f77f2a 100%); transform: translateY(-2px); }
#sale b { font-family: var(--title); font-size: 21px; letter-spacing: 0.3px; line-height: 1.15; display: block; }
#sale b .pct { color: #fde68a; }
#sale small { display: block; font-family: var(--mono); font-size: 13px; opacity: 0.96; margin-top: 2px; }
.sale-ic { display: grid; place-items: center; flex: none; width: 44px; height: 44px; background: rgba(255, 255, 255, 0.2); border: 1px solid rgba(255, 255, 255, 0.28); border-radius: 13px; }
@keyframes pop { from { transform: scale(0.5); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes salepulse { 50% { box-shadow: 0 0 0 5px rgba(244, 90, 60, 0.22), 0 10px 32px rgba(238, 90, 48, 0.55); } }

#hud { top: 10px; left: 200px; width: clamp(290px, calc(100vw - 720px), 460px); display: flex; align-items: center; gap: 12px; padding: 7px 10px; }
.hud-ic { background: rgba(52, 211, 153, 0.15); color: var(--green); border: 1px solid rgba(52, 211, 153, 0.35); border-radius: 10px; padding: 8px; }
.hud-main { flex: 1; min-width: 0; }
.hud-top { display: flex; align-items: baseline; gap: 8px; font-family: var(--mono); white-space: nowrap; }
#hud-n { font-size: 18px; color: var(--green); }
#hud-full { font-size: 11px; color: var(--muted); letter-spacing: 1px; }
#hud-rate { font-size: 10px; color: var(--muted); margin-left: auto; text-transform: uppercase; }
#hud-bar { height: 6px; background: rgba(148, 163, 184, 0.2); border-radius: 4px; margin-top: 5px; overflow: hidden; }
#hud-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #10b981, #34d399); transition: width 0.4s; border-radius: 4px; position: relative; }
#hud-bar i.full::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent); animation: shimmer 1.6s linear infinite; }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
#pts { display: flex; align-items: center; gap: 5px; background: rgba(251, 191, 36, 0.12); border: 1px solid rgba(251, 191, 36, 0.45); color: var(--yellow); padding: 5px 10px; border-radius: 10px; font-family: var(--mono); font-weight: 700; }
#pts.bump { animation: bump 0.45s; }
@keyframes bump { 40% { transform: scale(1.25); background: rgba(251, 191, 36, 0.35); } }

#nav { top: 10px; right: 10px; display: flex; gap: 2px; padding: 5px; align-items: center; flex-wrap: wrap; justify-content: flex-end; max-width: 62vw; }
#toolbar, #chips, .leaflet-control-zoom { transition: left 0.28s, transform 0.28s, margin 0.28s, width 0.28s; }
/* Panneau ouvert (ordinateur) : la barre d'outils se range à gauche pour ne pas passer dessous. */
@media (min-width: 1001px) {
  body.panel-open #toolbar { left: 10px; transform: none; width: min(900px, calc(100vw - 480px)); }
  body.panel-open #chips { left: calc((100vw - 460px) / 2); }
  body.panel-open .leaflet-control-zoom { margin-right: 460px !important; }
  body.panel-open #clan-btn { bottom: 210px; }
}
#nav button { border: 0; background: transparent; padding: 8px 11px; font-weight: 600; font-size: 13px; }
#nav button:hover { background: rgba(255, 255, 255, 0.09); }
#nav button.on { background: rgba(52, 211, 153, 0.18); color: var(--green); }
#nav button.gold { color: var(--yellow); }
#nav button.gold:hover { background: rgba(251, 191, 36, 0.14); }
#nav em { font-style: normal; }
#avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; margin-left: 4px; border: 2px solid rgba(255, 255, 255, 0.5); overflow: hidden; cursor: pointer; }
#avatar img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }

/* ---------- Panneau ---------- */
/* Panneau flottant sous la barre du haut : il ne la recouvre plus, plus de doublon visuel. */
#panel { position: fixed; z-index: 1100; top: 74px; right: 10px; bottom: 10px; width: min(440px, calc(100vw - 20px)); background: var(--panel); border: 1px solid var(--line); border-radius: 18px; backdrop-filter: blur(14px); overflow-y: auto; padding: 20px 18px 24px; box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5); }
#panel:not([hidden]) { animation: slidein 0.28s cubic-bezier(0.2, 0.9, 0.3, 1); }
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
#panel-close { position: absolute; top: 14px; right: 14px; border: 0; background: transparent; padding: 6px; }
#ptitle { margin: 0 0 6px; padding-right: 36px; font-family: var(--title); font-size: 28px; letter-spacing: -0.5px; text-transform: uppercase; }
#psub { margin: 0 0 14px; color: var(--muted); font-size: 15px; }
#panel-head { margin-bottom: 12px; }
#psub:empty { display: none; }
#ptabs { display: flex; gap: 2px; padding: 5px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 14px; }
#ptabs:empty { display: none; }
#ptabs button { flex: 1; flex-direction: column; gap: 3px; border: 1px solid transparent; background: transparent; font-size: 12px; font-weight: 600; padding: 8px 4px; color: var(--muted); }
#ptabs button.on { background: rgba(255, 255, 255, 0.1); border-color: var(--line); color: var(--text); }
#panel h3 { margin: 18px 0 8px; font-family: var(--mono); font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1.2px; display: flex; align-items: center; gap: 8px; }
.row { display: flex; gap: 6px; align-items: center; margin: 6px 0; }
.row > * { flex: 1; }
.row > button { flex: 0 0 auto; }
.tabs { display: flex; gap: 4px; margin-bottom: 10px; flex-wrap: wrap; }
.tabs button.on { background: var(--green); color: #022c22; border-color: transparent; }
.muted { color: var(--muted); font-size: 12px; }
.err { color: var(--red); min-height: 18px; }
.item { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); background: var(--card); border-radius: 12px; margin: 7px 0; animation: rise 0.3s both; }
.item img { width: 30px; height: 30px; border-radius: 7px; image-rendering: pixelated; object-fit: cover; }
.rank { width: 26px; color: var(--muted); font-family: var(--mono); }
.rank.top { color: var(--yellow); font-weight: 700; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Boutique */
.points-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px; border: 1px solid rgba(251, 191, 36, 0.4); background: rgba(251, 191, 36, 0.06); border-radius: 14px; margin-bottom: 12px; }
.points-card small { font-family: var(--mono); letter-spacing: 1.5px; color: var(--muted); font-size: 12px; }
.points-card big { display: block; font-family: var(--mono); font-size: 40px; font-weight: 800; color: var(--yellow); line-height: 1.1; }
.points-card p { margin: 0; max-width: 190px; text-align: right; color: var(--muted); }
.shop-card { display: flex; gap: 14px; align-items: center; padding: 16px; border: 1px solid var(--line); background: var(--card); border-radius: 14px; margin: 10px 0; animation: rise 0.3s both; transition: border-color 0.15s, transform 0.15s; }
.shop-card:hover { border-color: rgba(52, 211, 153, 0.4); transform: translateY(-2px); }
.shop-card .ico { background: rgba(52, 211, 153, 0.12); border: 1px solid rgba(52, 211, 153, 0.3); color: var(--green); border-radius: 12px; padding: 12px; }
.shop-card .txt { flex: 1; }
.shop-card .txt b { display: block; font-size: 17px; font-weight: 800; }
.shop-card .txt span { color: var(--muted); font-size: 13px; }
.price { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #1c1100; font-family: var(--mono); font-weight: 800; font-size: 15px; border: 0; border-radius: 10px; padding: 9px 12px; box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35); }
.price:hover { background: linear-gradient(135deg, #fcd34d, #f59e0b); }
.price.max { background: rgba(255, 255, 255, 0.08); color: var(--muted); box-shadow: none; }
.packs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pack { position: relative; display: block; text-align: left; padding: 16px; border: 1px solid var(--line); background: var(--card); border-radius: 14px; animation: rise 0.3s both; }
.packs.sale .pack { border-color: rgba(244, 63, 94, 0.6); background: rgba(244, 63, 94, 0.06); }
.pack:hover { transform: translateY(-3px) scale(1.02); border-color: var(--green); }
.pack .n { display: block; font-family: var(--mono); font-size: 28px; font-weight: 800; color: var(--green); }
.pack .u { color: var(--muted); }
.pack .p { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-family: var(--mono); font-weight: 800; font-size: 18px; }
.pack .p s { color: var(--muted); font-weight: 400; font-size: 13px; }
.pack .badge { position: absolute; top: -9px; right: 12px; background: var(--green); color: #022c22; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 6px; letter-spacing: 0.5px; }
.sale-tag { display: inline-flex; align-items: center; gap: 4px; background: var(--red); color: #fff; border-radius: 8px; padding: 3px 8px; font-weight: 800; font-size: 12px; letter-spacing: 0.5px; margin-left: auto; }
.fine { color: var(--muted); font-size: 13px; margin-top: 14px; }

/* ---------- Chips + barre d'outils ---------- */
#chips { position: fixed; z-index: 1000; bottom: 138px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; pointer-events: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 600; backdrop-filter: blur(8px); }
.chip.warn { border-color: rgba(251, 146, 60, 0.7); color: var(--orange); animation: nudge 2s ease-in-out infinite; }
.chip.mono { font-family: var(--mono); letter-spacing: 1px; }
.chip:not(.warn):not(.mono) { font-family: var(--mono); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.chip[hidden] { display: none; }
@keyframes nudge { 50% { transform: translateY(-3px); } }

#toolbar { bottom: 10px; left: 50%; transform: translateX(-50%); padding: 10px; width: min(900px, calc(100vw - 20px)); }
#palette { display: grid; grid-template-columns: repeat(24, 1fr); gap: 4px; }
#palette button { aspect-ratio: 1; padding: 0; border-radius: 6px; border: 2px solid transparent; transition: transform 0.12s, box-shadow 0.12s; }
#palette button:hover { transform: scale(1.12); }
#palette button.on { border-color: #fff; box-shadow: 0 0 0 2px #10b981, 0 4px 12px rgba(0, 0, 0, 0.4); transform: scale(1.14); z-index: 1; position: relative; animation: selpop 0.3s; }
@keyframes selpop { 50% { transform: scale(1.35); } }
#tools { display: flex; gap: 8px; align-items: center; margin-top: 9px; flex-wrap: wrap; }
#tools > button { padding: 7px 10px; }
#tools button.on { background: var(--green); color: #022c22; border-color: transparent; box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.25); }
.modtool { font-size: 12px; color: var(--yellow); }
.modtool em { font-style: normal; font-weight: 600; }
#color-hex { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 13px; padding: 0 6px; }
#color-hex i { width: 14px; height: 14px; border-radius: 4px; background: #dc2626; border: 1px solid rgba(255, 255, 255, 0.5); }
#hint { color: var(--muted); font-size: 11px; margin-left: auto; max-width: 290px; line-height: 1.3; }

/* ---------- Toast, règlement ---------- */
#toast { position: fixed; z-index: 3000; top: 74px; left: 50%; transform: translateX(-50%); background: #0f172a; border: 1px solid var(--line); padding: 10px 18px; border-radius: 12px; max-width: 90vw; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4); animation: toastin 0.3s cubic-bezier(0.3, 1.5, 0.5, 1); }
@keyframes toastin { from { transform: translate(-50%, -14px) scale(0.9); opacity: 0; } }
#rules { position: fixed; inset: 0; z-index: 2000; background: rgba(2, 6, 23, 0.75); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 12px; }
#rules[hidden], #toast[hidden], #panel[hidden], #sale[hidden], #nav-mod[hidden], .modtool[hidden], #avatar[hidden] { display: none; }
#rules .card { background: #0f172a; border: 1px solid var(--line); border-radius: 16px; padding: 22px; max-width: 520px; max-height: 92vh; overflow-y: auto; animation: pop 0.35s; }
#rules h2 { margin-top: 0; font-family: var(--title); text-transform: uppercase; }
#rules li { margin: 6px 0; }
#rules label { display: flex; gap: 8px; margin: 14px 0; align-items: center; }
#rules label input { width: auto; }
#rules-ok { width: 100%; background: var(--green); color: #022c22; font-weight: 700; padding: 11px; }

/* ---------- Carte et effets ---------- */
.px-layer { image-rendering: pixelated; image-rendering: crisp-edges; }
.px-overlay { image-rendering: pixelated; image-rendering: crisp-edges; min-width: 2px; min-height: 2px; pointer-events: none; }
body[data-theme="dark"] .leaflet-gl-layer { filter: invert(1) hue-rotate(180deg) brightness(0.9) contrast(1.1); }
body[data-theme="dark"] #map { background: #111827; }
.leaflet-container { cursor: crosshair; font-family: inherit; background: transparent; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: #0f172a; color: var(--text); border-radius: 14px; }
.leaflet-popup-content button { margin: 4px 4px 0 0; }
.leaflet-control-zoom { margin: 0 12px 150px 0 !important; border: 0 !important; }
.leaflet-control-zoom a { background: var(--panel) !important; color: var(--text) !important; border: 1px solid var(--line) !important; margin-bottom: 4px; border-radius: 10px !important; width: 36px !important; height: 36px !important; line-height: 34px !important; }

/* Mini lueur autour d'un pixel qui vient d'être posé */
.glow-wrap { pointer-events: none; }
.glow { position: absolute; display: block; border-radius: 2px; pointer-events: none; box-shadow: 0 0 6px 2px var(--c), 0 0 12px 3px rgba(255, 255, 255, 0.55); animation: glow 0.65s ease-out forwards; }
.glow.other { box-shadow: 0 0 5px 1px var(--c); animation-duration: 0.5s; }
@keyframes glow { from { opacity: 0.95; } to { opacity: 0; box-shadow: 0 0 12px 5px var(--c); } }

/* Signalements pour la modération */
.rep-pin span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--red); color: #fff; border: 2px solid #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45); animation: pinpulse 2s infinite; }
@keyframes pinpulse { 0% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.6), 0 2px 10px rgba(0, 0, 0, 0.45); } 70%, 100% { box-shadow: 0 0 0 14px rgba(244, 63, 94, 0), 0 2px 10px rgba(0, 0, 0, 0.45); } }
.nbadge { background: var(--red); color: #fff; font-size: 11px; min-width: 18px; height: 18px; border-radius: 9px; display: inline-grid; place-items: center; padding: 0 5px; margin-left: 2px; }
.nbadge[hidden] { display: none; }
.badge-ban { background: var(--red); color: #fff; border-radius: 6px; padding: 1px 6px; font-size: 11px; font-weight: 700; }
.badge-rep { background: rgba(251, 146, 60, 0.2); color: var(--orange); border-radius: 6px; padding: 1px 6px; font-size: 11px; font-weight: 700; }
.mini { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.mini button { padding: 5px 9px; font-size: 12px; }

/* ---------- Harmonisation : composants communs ---------- */
.card { padding: 14px; border: 1px solid var(--line); background: var(--card); border-radius: 14px; margin: 10px 0; animation: rise 0.3s both; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.card b { font-weight: 800; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.actions > select { flex: 1 1 130px; min-width: 0; }
.actions button { padding: 7px 11px; font-size: 13px; }
.ghost { background: transparent; }
select { font: inherit; color: var(--text); background: rgba(2, 6, 23, 0.6) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%238b97ad' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center; border: 1px solid var(--line); border-radius: 10px; padding: 8px 32px 8px 10px; appearance: none; -webkit-appearance: none; cursor: pointer; transition: border-color 0.15s; }
select:hover, select:focus { outline: none; border-color: var(--green); }
select option { background: #0f172a; color: var(--text); }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: #10b981; padding: 0; }
input[type="file"] { padding: 8px; cursor: pointer; }
input[type="file"]::file-selector-button { background: rgba(52, 211, 153, 0.15); color: var(--green); border: 1px solid rgba(52, 211, 153, 0.4); border-radius: 8px; padding: 5px 10px; margin-right: 10px; cursor: pointer; font: inherit; font-weight: 600; }
input[type="range"] { padding: 0; accent-color: #10b981; }
.check { display: flex; align-items: center; gap: 8px; margin: 8px 0; color: var(--text); cursor: pointer; }
.check input { flex: none; width: 18px; }
.field { display: grid; gap: 4px; margin: 8px 0; }
.field > span { font-size: 12px; color: var(--muted); }
.settings { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.settings .field { margin: 0; }
.badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 6px; padding: 2px 8px; font-size: 11px; font-weight: 800; letter-spacing: 0.3px; }
.badge.red { background: var(--red); color: #fff; }
.badge.orange { background: rgba(251, 146, 60, 0.18); color: var(--orange); }
.badge.green { background: rgba(52, 211, 153, 0.18); color: var(--green); }
.badge.gold { background: rgba(251, 191, 36, 0.18); color: var(--yellow); }
.tabs { padding: 4px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); border-radius: 12px; gap: 2px; }
.tabs button { flex: 1; background: transparent; border: 1px solid transparent; color: var(--muted); font-weight: 600; font-size: 13px; padding: 7px 8px; }
.tabs button:hover { color: var(--text); transform: none; }
.tabs button.on { background: rgba(255, 255, 255, 0.1); border-color: var(--line); color: var(--text); }
details.card summary { cursor: pointer; font-weight: 800; list-style: none; display: flex; align-items: center; gap: 8px; }
details.card summary::-webkit-details-marker { display: none; }
details.card summary::after { content: "＋"; margin-left: auto; color: var(--muted); }
details.card[open] summary::after { content: "−"; }
.leaflet-popup-content-wrapper { border: 1px solid var(--line); box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5); }
.leaflet-popup-content { margin: 12px 14px; font: 13px/1.4 "Segoe UI", system-ui, sans-serif; }
.leaflet-popup-close-button { color: var(--muted) !important; }
#sound.off { color: var(--muted); }

/* Récompense quotidienne */
.streak-card { display: flex; align-items: center; gap: 16px; padding: 18px; border: 1px solid rgba(251, 146, 60, 0.45); background: linear-gradient(135deg, rgba(251, 146, 60, 0.14), rgba(244, 63, 94, 0.07)); border-radius: 16px; margin-bottom: 14px; }
.streak-card .flame { font-size: 38px; line-height: 1; filter: drop-shadow(0 4px 12px rgba(251, 146, 60, 0.5)); animation: float 2.4s ease-in-out infinite; }
.streak-card small { font-family: var(--mono); letter-spacing: 1.5px; color: var(--muted); font-size: 12px; }
.streak-card big { display: block; font-family: var(--mono); font-size: 36px; font-weight: 800; color: var(--orange); line-height: 1.1; }
.streak-card p { margin: 0 0 0 auto; text-align: right; color: var(--muted); max-width: 170px; }
.points-card small { display: block; margin-bottom: 2px; }
.muted .ic, .item .ic, h3 .ic, .quest-top .ic, .pf-head .ic, .badge .ic, .tabs .ic { display: inline-block; vertical-align: -3px; }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.legend svg { display: inline-block; }
.countdown { font-family: var(--mono); font-size: 18px; font-weight: 800; color: var(--green); }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.day { position: relative; display: grid; gap: 2px; justify-items: center; padding: 8px 2px; border: 1px solid var(--line); background: var(--card); border-radius: 12px; font-family: var(--mono); animation: rise 0.3s both; }
.day small { font-size: 10px; color: var(--muted); letter-spacing: 0.5px; }
.day b { font-size: 13px; }
.day.done { border-color: rgba(52, 211, 153, 0.5); background: rgba(52, 211, 153, 0.1); color: var(--green); }
.day.today { border-color: var(--yellow); background: rgba(251, 191, 36, 0.14); color: var(--yellow); box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.18); }
.day.next { border-color: rgba(251, 146, 60, 0.6); border-style: dashed; }
.day.future { opacity: 0.75; }
.day.big { border-color: rgba(251, 191, 36, 0.55); background: rgba(251, 191, 36, 0.08); }
.day.big small { color: var(--yellow); }
.legend { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }

/* Boîte de dialogue maison (les confirm() natifs sont bloqués dans certains navigateurs intégrés) */
#dialog { position: fixed; inset: 0; z-index: 5000; background: rgba(2, 6, 23, 0.65); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; }
#dialog[hidden] { display: none; }
#dialog .card { max-width: 380px; width: 100%; background: #0f172a; margin: 0; padding: 18px; animation: pop 0.25s; }
#dialog p { margin: 0 0 6px; font-size: 15px; }

/* Boutique : sous-onglets, sons, couleurs spéciales */
.sub { margin-bottom: 12px; }
.item-card { display: flex; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line); background: var(--card); border-radius: 14px; margin: 9px 0; animation: rise 0.3s both; transition: border-color 0.15s; }
.item-card:hover { border-color: rgba(52, 211, 153, 0.35); }
.item-card.equipped { border-color: rgba(52, 211, 153, 0.7); background: rgba(52, 211, 153, 0.07); }
.item-card .ico { background: rgba(52, 211, 153, 0.12); border: 1px solid rgba(52, 211, 153, 0.3); color: var(--green); border-radius: 12px; padding: 10px; flex: none; }
.item-card .txt { flex: 1; min-width: 0; }
.item-card .txt b { display: block; font-size: 16px; font-weight: 800; }
.item-card .txt span { color: var(--muted); font-size: 13px; }
.item-card .buy { display: flex; flex-direction: column; gap: 6px; align-items: stretch; flex: none; }
.item-card .buy button { padding: 6px 10px; font-size: 13px; white-space: nowrap; }
.price.money { background: linear-gradient(135deg, #34d399, #10b981); color: #022c22; box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3); }
.dots { display: flex; gap: 5px; margin-top: 6px; }
.dots i { width: 22px; height: 22px; border-radius: 6px; border: 2px solid rgba(255, 255, 255, 0.55); box-shadow: 0 0 10px var(--c); }
.listen { padding: 4px 8px !important; font-size: 12px !important; }

/* Palette : couleurs spéciales */
#palette-premium { display: grid; grid-template-columns: repeat(24, 1fr); gap: 4px; margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); }
#palette-premium button { aspect-ratio: 1; padding: 0; border-radius: 6px; border: 2px solid transparent; position: relative; transition: transform 0.12s; }
#palette-premium button:hover { transform: scale(1.12); }
#palette-premium button.on { border-color: #fff; box-shadow: 0 0 0 2px #10b981; transform: scale(1.14); z-index: 1; }
#palette-premium button.locked { opacity: 0.45; filter: saturate(0.5); }
#palette-premium button.locked::after { content: ""; position: absolute; inset: 0; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 11h14v10H5z'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E") center / 60% no-repeat; filter: drop-shadow(0 1px 2px #000); }

/* Chat d'alliance */
.chat { display: flex; flex-direction: column; height: min(62vh, 560px); }
.chat-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 2px 8px; scroll-behavior: smooth; }
.msg { max-width: 82%; padding: 8px 12px; border-radius: 14px 14px 14px 4px; background: rgba(255, 255, 255, 0.07); border: 1px solid var(--line); align-self: flex-start; animation: rise 0.2s both; position: relative; word-break: break-word; }
.msg.me { align-self: flex-end; border-radius: 14px 14px 4px 14px; background: rgba(52, 211, 153, 0.16); border-color: rgba(52, 211, 153, 0.4); }
.msg .who { display: block; font-size: 12px; font-weight: 800; margin-bottom: 2px; }
.msg time { display: block; font: 10px var(--mono); color: var(--muted); margin-top: 3px; text-align: right; }
.msg .del { position: absolute; top: -8px; right: -6px; padding: 3px; border-radius: 50%; display: none; background: var(--red); border: 0; }
.msg:hover .del { display: inline-flex; }
.chat-form { display: flex; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; }
.chat-empty { margin: auto; text-align: center; color: var(--muted); }
#clan-btn { position: fixed; z-index: 1000; left: 10px; bottom: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 10px 16px; font-weight: 700; backdrop-filter: blur(8px); box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35); }
#clan-btn[hidden] { display: none; }
#clan-btn em { font-style: normal; }
@media (max-width: 1180px) { #clan-btn { bottom: 210px; } }

/* Récompense quotidienne : lecture en étapes */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 6px; }
.step { padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); font-size: 12px; color: var(--muted); }
.step b { display: flex; align-items: center; gap: 6px; color: var(--text); font-size: 13px; margin-bottom: 4px; }
.step .n { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--green); color: #022c22; font: 800 12px var(--mono); }
.today-card { padding: 18px; border-radius: 16px; border: 1px solid rgba(251, 191, 36, 0.5); background: linear-gradient(135deg, rgba(251, 191, 36, 0.16), rgba(251, 146, 60, 0.06)); margin-bottom: 12px; }
.today-card.done { border-color: rgba(52, 211, 153, 0.5); background: linear-gradient(135deg, rgba(52, 211, 153, 0.16), rgba(52, 211, 153, 0.04)); }
.today-top { display: flex; align-items: center; gap: 14px; }
.today-top .big-ic { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: rgba(255, 255, 255, 0.1); color: var(--yellow); flex: none; }
.today-card.done .big-ic { color: var(--green); }
.today-top h4 { margin: 0; font-size: 18px; }
.today-top p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.today-meta { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.today-meta b { color: var(--text); font-family: var(--mono); }
.today-meta span { display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.today-meta svg { color: var(--orange); }
.week-title { display: flex; align-items: baseline; justify-content: space-between; margin: 16px 0 8px; }
.week-title b { font-size: 15px; }
.day.lg { padding: 10px 2px; }
.day .tag { font: 800 9px var(--mono); letter-spacing: 0.5px; color: var(--yellow); }

/* Calques : taille libre */
.ov-size { display: grid; gap: 8px; margin: 8px 0; padding: 10px; border: 1px dashed var(--line); border-radius: 12px; }
.ov-size .row { margin: 0; }
.ov-btns { display: flex; gap: 4px; flex-wrap: wrap; }
.ov-btns button { padding: 5px 9px; font-size: 12px; flex: 1; }
.ov-size label.check { margin: 0; font-size: 12px; color: var(--muted); }

/* Couleurs verrouillées (base + spéciales) */
.nbadge.gold { background: var(--yellow); color: #1c1100; }
#palette button.locked { opacity: 0.38; filter: saturate(0.6); position: relative; }
#palette button.locked::after { content: ""; position: absolute; inset: 0; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 11h14v10H5z'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E") center / 50% no-repeat; filter: drop-shadow(0 1px 2px #000); }
#tool-inspect.on { background: var(--green); color: #022c22; }

/* Quêtes */
.quest { padding: 14px; border: 1px solid var(--line); background: var(--card); border-radius: 14px; margin: 9px 0; animation: rise 0.3s both; }
.quest.done { border-color: rgba(52, 211, 153, 0.5); background: rgba(52, 211, 153, 0.07); }
.quest-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.quest-top b { font-size: 15px; }
.bar { height: 8px; background: rgba(148, 163, 184, 0.2); border-radius: 5px; overflow: hidden; margin: 10px 0 6px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, #10b981, #34d399); border-radius: 5px; transition: width 0.4s; }
.quest.done .bar i { background: var(--green); }
.rewards { display: flex; gap: 6px; flex-wrap: wrap; }
.locked-colors { display: grid; grid-template-columns: repeat(9, 1fr); gap: 6px; }
.locked-colors button { aspect-ratio: 1; padding: 0; border-radius: 8px; border: 2px solid rgba(255, 255, 255, 0.2); transition: transform 0.12s; }
.locked-colors button:hover:not(:disabled) { transform: scale(1.15); border-color: #fff; }
.locked-colors button:disabled { opacity: 0.45; }

/* Profil d'un joueur */
.pf-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.pf-av { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font: 800 28px var(--title); color: #fff; border: 3px solid rgba(255, 255, 255, 0.5); overflow: hidden; flex: none; }
.pf-av img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.pf-head h4 { margin: 0; font-size: 20px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.stat { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.stat small { display: block; color: var(--muted); font: 11px var(--mono); letter-spacing: 1px; text-transform: uppercase; }
.stat b { font: 800 22px var(--mono); }
.pf-admin { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 4px; }

/* Calques partagés */
.shared-ov { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid rgba(52, 211, 153, 0.35); background: rgba(52, 211, 153, 0.05); border-radius: 12px; margin: 8px 0; }
.shared-ov .mini-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.shared-ov button { padding: 5px 9px; font-size: 12px; }

/* Calque en cours de modification sur la carte */
.ov-handle { width: 18px; height: 18px; background: #38bdf8; border: 3px solid #0b1220; border-radius: 5px; box-shadow: 0 0 0 2px #38bdf8, 0 2px 8px rgba(0, 0, 0, 0.5); }
.ov-label { pointer-events: none; }
.ov-label span { position: absolute; left: 0; top: 0; white-space: nowrap; background: #0b3b4f; color: #e6f9ff; border: 1px solid #38bdf8; border-radius: 8px; padding: 3px 10px; font: 700 13px var(--mono); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4); }
#ov-bar { position: fixed; z-index: 1050; top: 130px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--panel); border: 1px solid rgba(56, 189, 248, 0.6); border-radius: 14px; backdrop-filter: blur(8px); box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45); animation: pop 0.25s; max-width: calc(100vw - 20px); }
#ov-bar[hidden] { display: none; }
.ov-tip { display: grid; min-width: 0; }
.ov-tip b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.ov-tip small { color: var(--muted); font-size: 11px; }
#ov-op { width: 110px; padding: 0; accent-color: #38bdf8; }
#tool-overlay.on { background: #38bdf8; color: #082f49; }

/* Page de bienvenue / connexion */
#welcome { position: fixed; inset: 0; z-index: 2500; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: #070b13; background-image: linear-gradient(rgba(148, 163, 184, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(148, 163, 184, 0.05) 1px, transparent 1px); background-size: 44px 44px; overflow-y: auto; animation: fadein 0.35s; }
#welcome[hidden] { display: none; }
@keyframes fadein { from { opacity: 0; } }
.w-back { position: absolute; top: 28px; left: 28px; z-index: 2; background: transparent; border: 0; font-size: 16px; color: var(--text); gap: 10px; }
.w-left { position: relative; display: flex; flex-direction: column; justify-content: center; padding: 90px clamp(28px, 5vw, 70px) 70px; background: radial-gradient(ellipse at 20% 70%, rgba(52, 211, 153, 0.16), transparent 55%), radial-gradient(ellipse at 70% 100%, rgba(56, 189, 248, 0.1), transparent 50%); border-right: 1px solid rgba(148, 163, 184, 0.12); }
.w-left img { image-rendering: pixelated; animation: float 3.5s ease-in-out infinite; margin-bottom: 14px; }
.w-left h1 { margin: 0; font-family: var(--title); font-size: clamp(44px, 6vw, 70px); letter-spacing: -2px; line-height: 1; }
.w-left h1 span { color: var(--green); }
.w-left h1 b { color: var(--yellow); }
.w-tag { color: #9aa8bf; font-size: clamp(17px, 1.8vw, 24px); margin: 14px 0 30px; max-width: 560px; }
.w-feats { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.w-feats li { display: flex; gap: 16px; align-items: center; }
.w-feats .fi { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: rgba(52, 211, 153, 0.1); border: 1px solid rgba(52, 211, 153, 0.35); color: var(--green); flex: none; }
.w-feats b { display: block; font-size: 17px; }
.w-feats span span, .w-feats div > span { color: #8b97ad; font-size: 15px; }
.w-foot { position: absolute; left: clamp(28px, 5vw, 70px); bottom: 28px; font-family: var(--mono); letter-spacing: 2px; color: #64748b; }
.w-right { display: grid; place-items: center; padding: 30px; }
.w-card { width: min(470px, 100%); padding: 30px 32px 26px; background: #0b1120; border: 1px solid rgba(148, 163, 184, 0.18); border-radius: 22px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55); animation: pop 0.4s; }
.w-card h2 { margin: 0 0 18px; text-align: center; font-size: 22px; }
.w-card .tabs { margin-bottom: 16px; }
.w-card label { display: grid; gap: 6px; margin: 12px 0 0; font-size: 14px; font-weight: 600; }
.w-card input { padding: 11px 12px; }
.w-prov { width: 100%; padding: 11px; font-weight: 600; }
.w-prov-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.w-or { display: flex; align-items: center; gap: 12px; margin: 18px 0 4px; color: var(--muted); font-size: 12px; }
.w-or::before, .w-or::after { content: ""; flex: 1; height: 1px; background: rgba(148, 163, 184, 0.2); }
.w-go { width: 100%; margin-top: 18px; padding: 12px; font-size: 15px; }
.w-note { margin: 14px 0 0; text-align: center; color: var(--muted); font-size: 12px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* Installation de l'application */
#nav button.install { color: var(--green); }
#nav button.install:hover { background: rgba(52, 211, 153, 0.15); }
#nav button.install[hidden], #w-install[hidden] { display: none; }
.w-logo { flex: none; }
.app-box { padding: 12px 14px; border: 1px dashed rgba(52, 211, 153, 0.45); background: rgba(52, 211, 153, 0.05); border-radius: 12px; }

/* Barre d'action de la sélection de zone (modération) */
#zone-bar { position: fixed; z-index: 1050; top: 130px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; padding: 10px 14px; background: var(--panel); border: 1px solid rgba(244, 63, 94, 0.6); border-radius: 14px; backdrop-filter: blur(8px); box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45); animation: pop 0.25s; max-width: calc(100vw - 20px); }
#zone-bar[hidden] { display: none; }
#zone-info { font-family: var(--mono); font-size: 13px; }
#zone-del svg { margin-right: 2px; }

/* Calques */
.ov-card { padding: 12px; border: 1px solid var(--line); background: var(--card); border-radius: 14px; margin: 10px 0; animation: rise 0.3s both; }
.ov-head { display: flex; gap: 10px; align-items: center; }
.ov-head img { width: 46px; height: 46px; object-fit: contain; image-rendering: pixelated; background: repeating-conic-gradient(#334155 0 25%, #1e293b 0 50%) 0 0 / 10px 10px; border-radius: 8px; }
.ov-head div { flex: 1; min-width: 0; }
.ov-head b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-del { width: 100%; margin-top: 8px; }
.ov-arrows { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
#palette-toggle { display: none; }
#palette-toggle i { width: 18px; height: 18px; border-radius: 5px; border: 2px solid #fff; background: #dc2626; }
#tool-brush.on { background: var(--green); color: #022c22; }
.cf { position: fixed; z-index: 4000; width: 9px; height: 14px; border-radius: 2px; pointer-events: none; }

/* Sous 1700 px : icônes seules dans la barre du haut, pour ne jamais recouvrir la jauge. */
@media (max-width: 1700px) { #nav em { display: none; } }

/* ---------- Version téléphone ---------- */
body[data-tool="brush"] #map, body[data-tool="brush"] .leaflet-container { touch-action: none; cursor: cell; }
@media (max-width: 1000px) {
  html, body { height: 100dvh; }
  #brand { top: calc(env(safe-area-inset-top) + 8px); left: 8px; padding: 4px; }
  #brand strong { display: none; }
  #hud { top: calc(env(safe-area-inset-top) + 8px); left: 56px; right: 8px; width: auto; min-width: 0; padding: 5px 8px; gap: 8px; transform: none; }
  .hud-ic { padding: 5px; }
  .hud-ic svg { width: 18px; height: 18px; }
  #hud-n { font-size: 16px; }
  #hud-rate { display: none; }
  #pts { padding: 4px 8px; }
  #nav { top: calc(env(safe-area-inset-top) + 58px); left: 8px; right: 8px !important; max-width: none; flex-wrap: nowrap; overflow-x: auto; justify-content: space-between; padding: 3px; scrollbar-width: none; }
  #nav::-webkit-scrollbar { display: none; }
  #nav button { padding: 8px 10px; flex: none; }
  #nav em { display: none !important; }
  #avatar { display: none !important; }
  #sale { top: calc(env(safe-area-inset-top) + 108px); left: 8px; padding: 8px 16px 8px 8px; gap: 10px; min-width: 0; border-radius: 16px; }
  #sale b { font-size: 17px; }
  #sale small { font-size: 11px; }
  #zone-bar { top: calc(env(safe-area-inset-top) + 160px); }
  #ptabs button { font-size: 10px; padding: 8px 2px; }
  .days { gap: 4px; }
  .streak-card { padding: 14px; gap: 12px; }
  .streak-card big { font-size: 30px; }
  .settings { grid-template-columns: 1fr; }
  #clan-btn { display: none; }
  #palette-premium { grid-template-columns: repeat(8, 1fr); gap: 6px; display: none; }
  #toolbar.open #palette-premium { display: grid; }
  .item-card { flex-wrap: wrap; }
  .item-card .buy { flex-direction: row; width: 100%; }
  .item-card .buy button { flex: 1; }
  .chat { height: calc(82dvh - 320px); min-height: 220px; }
  .steps { grid-template-columns: 1fr; }
  #ov-bar { top: calc(env(safe-area-inset-top) + 160px); flex-wrap: wrap; justify-content: center; }
  .ov-tip small { display: none; }
  #welcome { grid-template-columns: 1fr; grid-template-rows: auto auto; align-content: start; }
  .w-left { padding: 76px 22px 8px; border-right: 0; align-items: center; text-align: center; }
  .w-left img { width: 64px; height: 64px; }
  .w-feats, .w-foot { display: none; }
  .w-tag { margin: 10px 0 0; font-size: 16px; }
  .w-back { top: calc(env(safe-area-inset-top) + 18px); left: 16px; }
  .w-right { padding: 18px 14px 30px; }
  .w-card { padding: 22px 18px; }
  .locked-colors { grid-template-columns: repeat(6, 1fr); }
  #panel-head { margin-bottom: 8px; }
  .sale-ic { width: 36px; height: 36px; border-radius: 11px; }
  .sale-ic svg { width: 20px; height: 20px; }

  .leaflet-control-zoom { display: none; }
  #chips { bottom: calc(env(safe-area-inset-bottom) + 84px); gap: 6px; }
  #chip-shift, #chip-xy { display: none; }
  .chip { font-size: 12px; padding: 5px 11px; }
  body.pal-open #chips { display: none; }

  #toolbar { left: 8px; right: 8px; width: auto; transform: none; bottom: calc(env(safe-area-inset-bottom) + 8px); padding: 8px; }
  #palette { display: none; grid-template-columns: repeat(8, 1fr); gap: 6px; margin-bottom: 8px; }
  #toolbar.open #palette { display: grid; animation: rise 0.2s; }
  #palette button { border-radius: 8px; }
  #tools { margin-top: 0; gap: 6px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  #tools::-webkit-scrollbar { display: none; }
  #tools > button { flex: none; padding: 9px 11px; }
  #palette-toggle { display: inline-flex; font-size: 12px; order: -1; margin-left: 0; }
  #color-hex, #hint { display: none; }
  .modtool em { display: none; }

  #panel { top: auto; left: 0; right: 0; bottom: 0; width: 100%; height: 82dvh; border-left: 0; border-top: 1px solid var(--line); border-radius: 20px 20px 0 0; padding: 18px 14px calc(env(safe-area-inset-bottom) + 24px); box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.5); }
  #panel:not([hidden]) { animation: sheetup 0.3s cubic-bezier(0.2, 0.9, 0.3, 1); }
  #panel::before { content: ""; display: block; width: 44px; height: 4px; border-radius: 2px; background: rgba(148, 163, 184, 0.45); margin: -8px auto 12px; }
  #ptitle { font-size: 24px; }
  #psub { font-size: 14px; margin-bottom: 12px; }
  #panel-close { top: 10px; right: 10px; }
  .packs { gap: 8px; }
  .pack { padding: 12px; }
  .pack .n { font-size: 22px; }
  .shop-card { padding: 12px; gap: 10px; }
  .points-card big { font-size: 32px; }
  body.panel-open #nav { right: 8px; }
  #rules .card { padding: 16px; }
  #toast { top: calc(env(safe-area-inset-top) + 110px); font-size: 13px; }
}
@keyframes sheetup { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Palette repliable (ordinateur) : seuls les outils et la couleur choisie restent visibles */
#palette-collapse { padding: 7px 9px; }
#color-hex { cursor: pointer; }
@media (max-width: 1000px) { #palette-collapse { display: none; } }
@media (min-width: 1001px) {
  #toolbar.collapsed #palette, #toolbar.collapsed #palette-premium, #toolbar.collapsed #hint { display: none; }
  #toolbar.collapsed { width: auto; max-width: calc(100vw - 20px); }
  #toolbar.collapsed #tools { margin-top: 0; }
  body.panel-open #toolbar.collapsed { width: auto; }
  body.pal-collapsed #chips { bottom: 84px; }
  body.pal-collapsed #clan-btn, body.pal-collapsed.panel-open #clan-btn { bottom: 10px; }
}
