/* Planete Karia — Design system unique (v12.8.4+) */
/* 1 police, 3 tailles de texte, 5 couleurs de marque, classes semantiques + structurelles. */

@font-face {
	font-family: 'Manrope';
	font-style: normal;
	font-weight: 200 800;
	font-display: swap;
	src: url('../fonts/manrope-variable.woff2') format('woff2');
}

:root {
	--font-family: 'Manrope', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

	/* 3 tailles de texte — toute la hierarchie de texte tient sur ces 3 valeurs */
	--text-lg: 1.2rem;
	--text-md: 0.95rem;
	--text-sm: 0.75rem;

	/* 2 graisses seulement : normal et gras */
	--weight-text: 500;
	--weight-bold: 700;

	/* 1 seule taille pour les glyphes decoratifs (emoji/icones), hors des 3 tailles de texte */
	--glyph-size: 1.8rem;

	/* Neutres — cool paper / encre quasi-noire */
	--bg: #f7f8fb;
	--surface: #ffffff;
	--surface-rgb: 255, 255, 255;
	--card-solid: #ffffff;
	--text: #12161f;
	--primary: #12161f;
	--muted: #5c6779;
	--muted-rgb: 92, 103, 121;
	--border: #dde3ea;
	--bg-card: var(--surface);
	--text-muted: var(--muted);
	--text-primary: var(--text);

	/* 5 couleurs de marque maximum — appliquees partout, y compris les legendes de categories (Ville, Zoo) */
	--accent: #e2593f;
	--accent-rgb: 226, 89, 63;
	--secondary: #8b5cf6;
	--secondary-rgb: 139, 92, 246;
	--success: #1b8a5a;
	--success-rgb: 27, 138, 90;
	--warning: #a5690a;
	--warning-rgb: 165, 105, 10;
	--error: #b8264f;
	--error-rgb: 184, 38, 79;

	--btn-text: #ffffff;
	--on-accent: #ffffff;
	--btn-gradient-from: var(--accent);
	--btn-gradient-to: var(--accent);
	--btn-shadow-rgb: var(--accent-rgb);
	--btn-secondary-rgb: var(--muted-rgb);
	--ring: 0 0 0 3px rgba(var(--accent-rgb), 0.25);

	/* Surfaces plates (plus de glassmorphism) */
	--glass: var(--surface);
	--glass-border: var(--border);
	--input-bg: var(--surface);

	--shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
	--shadow: 0 4px 20px rgba(0, 0, 0, 0.07);
	--shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.1);
	--shadow-toast: 0 4px 16px rgba(0, 0, 0, 0.18);

	--overlay-white-rgb: 255, 255, 255;
	--overlay-dark: rgba(0, 0, 0, 0.45);
	--scrollbar-thumb: rgba(0, 0, 0, 0.15);
	--city-missing-rgb: var(--warning-rgb);
	--story-found-rgb: var(--success-rgb);
	--story-lost-rgb: var(--error-rgb);

	--radius-sm: 9px;
	--radius: 13px;
	--radius-lg: 18px;
	--radius-pill: 999px;

	--space: 20px;
	--max: 1280px;

	/* 2 ecarts seulement : serre et large */
	--gap-sm: 8px;
	--gap-lg: 16px;

	--pad-card: var(--space);
	--pad-hero: var(--space);
	--pad-content-wrap: var(--space);
	--accent-stripe-w: 4px;
	--accent-stripe-inset: 12px;

	/* Menu gauche */
	--sidebar-w: 260px;
	--sidebar-bg: var(--surface);
	--sidebar-shadow: 2px 0 16px rgba(0, 0, 0, 0.06);
	--sidebar-text: var(--muted);
	--sidebar-text-active: var(--text);
	--sidebar-hover: rgba(0, 0, 0, 0.04);
	--sidebar-active-bg: rgba(var(--accent-rgb), 0.12);
	--sidebar-divider: var(--border);
	--topbar-h: 56px;

	--z-base: 0;
	--z-raised: 1;
	--z-dropdown: 100;
	--z-topbar: 190;
	--z-sidebar: 200;
	--z-overlay: 210;
	--z-modal: 500;
	--z-toast: 1000;
	--z-tooltip: 9999;
}

[data-theme="dark"] {
	--bg: #10131a;
	--surface: #1a1e29;
	--surface-rgb: 26, 30, 41;
	--card-solid: #1a1e29;
	--text: #eef1f5;
	--primary: #eef1f5;
	--muted: #8b93a3;
	--muted-rgb: 139, 147, 163;
	--border: #262c3a;

	--accent: #f0785c;
	--accent-rgb: 240, 120, 92;
	--secondary: #a78bfa;
	--secondary-rgb: 167, 139, 250;
	--success: #3aa374;
	--success-rgb: 58, 163, 116;
	--warning: #d99a2e;
	--warning-rgb: 217, 154, 46;
	--error: #d65c7c;
	--error-rgb: 214, 92, 124;

	--shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.25);
	--shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
	--shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.4);
	--scrollbar-thumb: rgba(255, 255, 255, 0.12);

	--sidebar-bg: #171a22;
	--sidebar-shadow: 2px 0 16px rgba(0, 0, 0, 0.3);
	--sidebar-hover: rgba(255, 255, 255, 0.04);
	--sidebar-divider: rgba(255, 255, 255, 0.05);
}

/* ══════════════════════════════════════════
   RESET & BASE
   ══════════════════════════════════════════ */
*, *::before, *::after {
	box-sizing: border-box;
}

html, body {
	margin: 0;
	padding: 0;
}

body {
	font-family: var(--font-family);
	font-size: var(--text-md);
	color: var(--text);
	background: var(--bg);
	min-height: 100vh;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	line-height: 1.6;
	font-weight: var(--weight-text);
}

h1, h2, h3 {
	margin: 0 0 var(--gap-lg);
	line-height: 1.25;
	letter-spacing: -0.02em;
	text-wrap: balance;
}

h1 { font-size: var(--text-lg); font-weight: var(--weight-bold); }
h2 { font-size: var(--text-md); font-weight: var(--weight-bold); }
h3 { font-size: var(--text-md); font-weight: var(--weight-bold); }

p {
	margin: 8px 0;
	line-height: 1.6;
}

a, .link {
	color: var(--accent);
	text-decoration: none;
	transition: color 0.2s ease;
}

a:hover, .link:hover {
	text-decoration: underline;
}

/* ══════════════════════════════════════════
   TEXTE SEMANTIQUE — Titre / Sous-titre / Description / Texte / Annotation / Valeur
   ══════════════════════════════════════════ */
.title {
	font-size: var(--text-lg);
	font-weight: var(--weight-bold);
	color: var(--text);
	letter-spacing: -0.02em;
	line-height: 1.25;
}

.subtitle {
	font-size: var(--text-md);
	font-weight: var(--weight-bold);
	color: var(--text);
	margin-top: 0;
}

.description {
	font-size: var(--text-sm);
	font-weight: var(--weight-text);
	color: var(--muted);
	line-height: 1.5;
}

.text {
	font-size: var(--text-md);
	font-weight: var(--weight-text);
	color: var(--text);
}

.annotation, .muted {
	font-size: var(--text-sm);
	font-weight: var(--weight-text);
	color: var(--muted);
}

.value-highlight, .highlight {
	color: var(--accent);
	font-weight: var(--weight-bold);
	font-variant-numeric: tabular-nums;
}

.mt-half { margin-top: calc(var(--space) / 2); }
.mb-half { margin-bottom: calc(var(--space) / 2); }

/* ══════════════════════════════════════════
   BOUTON
   ══════════════════════════════════════════ */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--gap-sm);
	padding: 10px 22px;
	border-radius: var(--radius);
	border: none;
	background: var(--btn-gradient-from);
	color: var(--btn-text);
	text-decoration: none;
	cursor: pointer;
	font-family: inherit;
	font-weight: var(--weight-bold);
	font-size: var(--text-md);
	letter-spacing: 0.01em;
	box-shadow: 0 4px 14px rgba(var(--btn-shadow-rgb), 0.3);
	transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
	position: relative;
	overflow: hidden;
}

a.btn, .card a.btn,
a.btn:visited, .card a.btn:visited,
a.btn:hover, .card a.btn:hover,
a.btn:focus, .card a.btn:focus {
	color: var(--btn-text);
	text-decoration: none;
}

.btn::after {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(135deg, rgba(var(--overlay-white-rgb), 0.15), transparent 60%);
	opacity: 0;
	transition: opacity 0.25s ease;
	pointer-events: none;
}

.btn:hover {
	transform: translateY(-2px);
	box-shadow: 0 8px 24px rgba(var(--btn-shadow-rgb), 0.45);
	text-decoration: none;
}

.btn:hover::after { opacity: 1; }
.btn:active { transform: translateY(0) scale(0.98); }

.btn--secondary {
	background: rgb(var(--btn-secondary-rgb));
	box-shadow: 0 4px 14px rgba(var(--btn-secondary-rgb), 0.25);
}
.btn--secondary:hover { box-shadow: 0 8px 24px rgba(var(--btn-secondary-rgb), 0.4); }

.btn:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
	outline: none;
	box-shadow: var(--ring);
}

.btn--neutral {
	background: transparent;
	color: var(--text);
	box-shadow: none;
	border: 1px solid var(--border);
}
.btn--neutral:hover { background: rgba(0, 0, 0, 0.03); box-shadow: none; transform: none; }

.btn--danger {
	background: var(--error);
	box-shadow: 0 4px 14px rgba(var(--error-rgb), 0.25);
}
.btn--danger:hover { box-shadow: 0 8px 24px rgba(var(--error-rgb), 0.4); }

.btn--accent {
	background: var(--accent);
	box-shadow: 0 4px 14px rgba(var(--accent-rgb), 0.25);
}
.btn--accent:hover { box-shadow: 0 8px 24px rgba(var(--accent-rgb), 0.4); }

.btn--primary { background: var(--btn-gradient-from); }

.btn--small, .btn--sm { padding: 6px 14px; font-size: var(--text-sm); }

.btn--ghost { background: transparent; color: var(--text); box-shadow: none; border: 1px solid transparent; }
.btn--ghost:hover { background: rgba(0, 0, 0, 0.03); box-shadow: none; transform: none; }

.btn--active {
	background: rgba(var(--accent-rgb), 0.15);
	border: 1px solid rgba(var(--accent-rgb), 0.3);
	color: var(--accent);
	box-shadow: none;
}
.btn--active:hover { background: rgba(var(--accent-rgb), 0.2); box-shadow: none; }

.btn--full { width: 100%; }

.btn:disabled, button:disabled {
	opacity: 0.4;
	cursor: not-allowed;
	background: var(--surface);
	color: var(--muted);
	border: 1px solid var(--border);
	box-shadow: none;
	transform: none;
}
.btn:disabled::after { display: none; }

.btn.btn--loading, .btn.is-loading { opacity: 0.65; pointer-events: none; cursor: wait; }
.btn--loading::after {
	content: '';
	position: absolute;
	right: 8px;
	top: 50%;
	width: 14px;
	height: 14px;
	margin-top: -7px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-top-color: var(--btn-text);
	border-radius: 50%;
	animation: btn-spin 0.6s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════
   CARD
   ══════════════════════════════════════════ */
.card {
	position: relative;
	overflow: hidden;
	scroll-margin-top: 80px;
	border-radius: var(--radius-lg);
	padding: var(--pad-card);
	margin-bottom: 16px;
	background: var(--surface);
	border: 1px solid var(--border);
	box-shadow: var(--shadow-sm);
	transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s ease, border-color 0.3s ease;
	display: flex;
	flex-direction: column;
	gap: var(--gap-sm);
}

.grid > .card { margin-bottom: 0; }
.card:last-child { margin-bottom: 0; }

.card:hover {
	transform: translateY(-3px);
	box-shadow: var(--shadow-lg);
	border-color: rgba(var(--accent-rgb), 0.2);
}

.card__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: var(--gap-lg);
	padding-bottom: 10px;
	margin-bottom: 10px;
	border-bottom: 1px solid var(--border);
}

.card__heading { min-width: 0; flex: 1; }
.card__actions { display: flex; flex-wrap: wrap; gap: var(--gap-sm); justify-content: flex-end; }
.card__body { margin-top: 0; }
.card ul { margin: 8px 0 0; padding-left: 20px; }
.card li { margin: 5px 0; line-height: 1.55; }
.card a { color: var(--accent); text-decoration: none; transition: color 0.2s ease; }
.card a:hover { color: var(--text); text-decoration: underline; }

.grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--gap-lg);
}
.grid + .card { margin-top: 16px; }

.card--featured {
	border-color: rgba(var(--accent-rgb), 0.5);
	box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.12), 0 4px 20px rgba(var(--accent-rgb), 0.1);
}

.card-badge {
	font-size: var(--text-sm);
	text-transform: uppercase;
	padding: 2px 8px;
	vertical-align: middle;
	margin-right: 6px;
	letter-spacing: 0.04em;
}
.card-badge--start { background: var(--accent); color: var(--on-accent); }

/* Surfaces partagees par des blocs de rubrique qui n'ont pas leur propre fond/bordure */
.st__story, .arena__bestiary-card,
.zoo-panel, .zoo-content, .zoo-enc, .zoo-badge, .zoo-species-card {
	background: var(--surface);
	border: 1px solid var(--border);
}

/* Encadre leger pour du texte contextuel qui ne doit pas flotter directement sur le fond de page */
.hint-panel {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow-sm);
	padding: 10px 14px;
	display: flex;
	flex-direction: column;
	gap: 4px;
}
.hint-panel > .description, .hint-panel > .annotation, .hint-panel > .muted {
	margin: 0;
}

/* Panneau simple (non-glass) et badge (forme partagee, couleurs locales) */
.panel,
.ex__choice, .te__tree, .ra__vehicle, .ra__daily,
.arena__progress-section, .arena-combat, .confirm-modal, .home-timer {
	background: var(--surface);
	border: 1px solid var(--border);
}

.badge,
.adm__avg-badge, .arena__tier-badge, .arena-combat__boss-badge, .card-badge,
.ra__phase-badge, .ra__circuit-status-badge, .zoo-badge, .zoo-compat-badge {
	display: inline-flex;
	align-items: center;
	font-weight: var(--weight-bold);
	border-radius: var(--radius-pill);
}

/* ══════════════════════════════════════════
   FORMULAIRES
   ══════════════════════════════════════════ */
.flash-list { display: flex; flex-direction: column; gap: var(--gap-sm); margin-bottom: 16px; }

.flash {
	border-radius: var(--radius);
	padding: 14px 40px 14px 18px;
	border: 1px solid var(--border);
	background: var(--surface);
	border-left: 4px solid var(--border);
	animation: flashSlideIn 0.3s ease-out forwards;
	position: relative;
}

.flash__close {
	position: absolute;
	top: 50%;
	right: 10px;
	transform: translateY(-50%);
	background: none;
	border: none;
	cursor: pointer;
	color: inherit;
	opacity: 0.5;
	font-size: var(--text-md);
	line-height: 1;
	padding: 4px 6px;
	border-radius: var(--radius-sm);
	transition: opacity 0.15s;
}
.flash__close:hover { opacity: 1; }

.flash-success {
	border-color: rgba(var(--success-rgb), 0.15);
	color: var(--success);
	border-left-color: var(--success);
	background: rgba(var(--success-rgb), 0.06);
}
.flash-error {
	border-color: rgba(var(--error-rgb), 0.15);
	color: var(--error);
	border-left-color: var(--error);
	background: rgba(var(--error-rgb), 0.06);
}

.form { display: grid; gap: var(--gap-lg); }
.form__label { font-weight: var(--weight-bold); font-size: var(--text-md); }
.form--inline { display: inline; }
.input { flex: 1; }

select.input {
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	width: 100%;
	padding: 8px 36px 8px 14px;
	border-radius: var(--radius);
	border: 1px solid var(--border);
	background-color: var(--input-bg);
	color: var(--text);
	font: inherit;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
	background-image:
		linear-gradient(45deg, transparent 50%, var(--muted) 50%),
		linear-gradient(135deg, var(--muted) 50%, transparent 50%);
	background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%;
	background-size: 6px 6px;
	background-repeat: no-repeat;
}
select.input:focus { border-color: var(--accent); box-shadow: var(--ring); outline: none; }

label { display: grid; gap: var(--gap-sm); margin: 10px 0; font-weight: var(--weight-text); }

input, textarea {
	width: 100%;
	padding: 8px 14px;
	border-radius: var(--radius);
	border: 1px solid var(--border);
	outline: none;
	background: var(--input-bg);
	color: var(--text);
	font: inherit;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
textarea { resize: vertical; }
input:focus, textarea:focus { border-color: var(--accent); box-shadow: var(--ring); }

/* ══════════════════════════════════════════
   TABLEAU
   ══════════════════════════════════════════ */
.table { display: grid; gap: var(--gap-sm); }

.table__row {
	display: grid;
	grid-template-columns: 2fr 0.7fr 1fr 1fr 1.6fr;
	gap: var(--gap-lg);
	align-items: center;
	padding: 10px 14px;
	border-radius: var(--radius);
	background: var(--surface);
	border: 1px solid var(--border);
	transition: all 0.15s ease;
}
.table__row:hover { border-color: rgba(var(--accent-rgb), 0.2); background: rgba(var(--accent-rgb), 0.03); }

.table__row--current {
	border-color: rgba(var(--accent-rgb), 0.35);
	background: rgba(var(--accent-rgb), 0.08);
	font-weight: var(--weight-bold);
}
.table__row--current:hover { background: rgba(var(--accent-rgb), 0.12); }

.table--two .table__row { grid-template-columns: 2fr 1fr; }
.table--history-economy .table__row { grid-template-columns: 1fr 2.2fr 0.8fr; }

.table__row--head {
	font-weight: var(--weight-bold);
	background: rgba(var(--surface-rgb), 0.7);
	border-color: var(--border);
	text-transform: uppercase;
	font-size: var(--text-sm);
	letter-spacing: 0.04em;
	color: var(--muted);
}
.table__row--head:hover { transform: none; background: rgba(var(--surface-rgb), 0.7); }

.cell-right { text-align: right; justify-self: end; }

/* ══════════════════════════════════════════
   RESSOURCES / STATS / PROGRESSION / TOOLTIPS
   ══════════════════════════════════════════ */
.resource-bar { display: flex; flex-wrap: wrap; gap: var(--gap-lg); padding: 12px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }

.resource-item {
	display: inline-flex;
	align-items: center;
	gap: var(--gap-sm);
	padding: 6px 12px;
	border: 1px solid var(--border);
	border-radius: var(--radius-pill);
	background: rgba(var(--surface-rgb), 0.5);
	white-space: nowrap;
	transition: all 0.2s ease;
	font-size: var(--text-md);
}
.resource-item:hover { border-color: rgba(var(--accent-rgb), 0.2); background: rgba(var(--accent-rgb), 0.05); }
.resource-bar__break { flex-basis: 100%; height: 0; }

.ckp__stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--gap-lg); margin-bottom: 16px; }

.ckp__stat {
	position: relative;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	padding: 16px 12px 14px;
	border-radius: var(--radius-lg);
	text-align: center;
	background: var(--surface);
	border: 1px solid var(--border);
	box-shadow: var(--shadow-sm);
	transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.25s ease, border-color 0.25s ease;
}
.ckp__stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: rgba(var(--accent-rgb), 0.25); }
.ckp__stat-icon { font-size: var(--text-md); filter: drop-shadow(0 2px 6px rgba(var(--accent-rgb), 0.35)); }
.ckp__stat-val { font-size: var(--text-md); font-weight: var(--weight-bold); line-height: 1.2; }
.ckp__stat-val--alert { color: var(--error); }
.ckp__stat-lbl { font-size: var(--text-sm); color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: var(--weight-bold); }

.progress-list { display: flex; flex-direction: column; gap: var(--gap-lg); }
.progress-list__item { display: flex; flex-direction: column; gap: var(--gap-sm); }
.progress-list__label { display: flex; justify-content: space-between; align-items: baseline; font-size: var(--text-md); }
.progress-list .city-progress { margin: 0; }

.city-progress {
	margin: 10px 0 14px;
	background: rgba(var(--surface-rgb), 0.5);
	border-radius: var(--radius-pill);
	border: 1px solid var(--border);
	height: 8px;
	overflow: hidden;
}
.city-progress__bar { height: 100%; background: var(--accent); border-radius: var(--radius-pill); transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1); }

/* Barre de progression partagee (admin, ville, arene, course) */
.adm__progress-fill, .arena__bprogress-fill, .ra__upgrade-bar-fill {
	height: 100%;
	width: var(--bar-pct, 0%);
	background: var(--accent);
	border-radius: 3px;
	transition: width 0.4s ease;
}
.ra__upgrade-bar-fill { border-radius: 2px; }

[data-tooltip] { position: relative; cursor: help; }
[data-tooltip]::before {
	content: attr(data-tooltip);
	position: absolute;
	bottom: calc(100% + 6px);
	left: 50%;
	transform: translateX(-50%);
	background: var(--surface);
	color: var(--text);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	padding: 6px 10px;
	font-size: var(--text-md);
	font-weight: var(--weight-text);
	max-width: 240px;
	white-space: normal;
	text-align: center;
	box-shadow: var(--shadow);
	pointer-events: none;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.18s ease, visibility 0.18s ease;
	z-index: var(--z-dropdown);
}
[data-tooltip]:hover::before, [data-tooltip].is-tooltip-open::before { opacity: 1; visibility: visible; }
[data-tooltip][data-tooltip-pos="below"]::before { bottom: auto; top: calc(100% + 6px); }

/* ══════════════════════════════════════════
   NOTIFICATIONS / ACTIVITE
   ══════════════════════════════════════════ */
.notifications-list { display: flex; flex-direction: column; gap: var(--gap-sm); }

.notification-item, .activity-item {
	padding: 12px 14px;
	border-radius: var(--radius);
	background: var(--surface);
	border: 1px solid var(--border);
	display: flex;
	justify-content: space-between;
	gap: var(--gap-lg);
	transition: all 0.15s ease;
}
.notification-item:hover, .activity-item:hover { border-color: rgba(var(--accent-rgb), 0.2); }
.notification-item.is-unread { background: rgba(var(--accent-rgb), 0.05); border-left: 3px solid var(--accent); }

.notification-message { font-weight: var(--weight-text); }
.notification-time { color: var(--muted); font-size: var(--text-md); white-space: nowrap; }

.notif-filters { display: flex; flex-wrap: wrap; gap: var(--gap-sm); margin-bottom: var(--gap-sm); }
.activity-list { display: flex; flex-direction: column; gap: var(--gap-sm); }
.activity-message { font-weight: var(--weight-text); line-height: 1.5; }

/* ══════════════════════════════════════════
   DIVERS UTILITAIRE
   ══════════════════════════════════════════ */
.cost-line-stacked { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.cost-line-label { font-size: var(--text-sm); color: var(--muted); font-weight: var(--weight-bold); line-height: 1.4; }
.cost-line-value { font-size: var(--text-sm); color: var(--text); font-weight: var(--weight-bold); line-height: 1.4; }

.confirm-modal-backdrop {
	position: fixed;
	inset: 0;
	background: var(--overlay-dark);
	z-index: var(--z-modal);
	display: flex;
	align-items: center;
	justify-content: center;
	animation: fadeIn 0.15s ease;
}
.confirm-modal { border-radius: var(--radius-lg); padding: 24px; max-width: 380px; width: 90%; box-shadow: var(--shadow-lg); animation: scaleIn 0.15s ease; }
.confirm-modal__msg { margin: 0 0 20px; line-height: 1.55; }
.confirm-modal__actions { display: flex; gap: var(--gap-lg); justify-content: flex-end; }

/* ══════════════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════════════ */
@keyframes fadeSlideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: scale(1); } }
@keyframes flashSlideIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

.anim-in { opacity: 0; }
.anim-in.is-visible { animation: fadeSlideUp 0.45s cubic-bezier(0.22, 1, 0.36, 1) both; }
.anim-in.anim-in--fade.is-visible { animation-name: fadeIn; }
.anim-in.anim-in--scale.is-visible { animation-name: scaleIn; }
.anim-in.anim-in--delay-1 { animation-delay: 0.06s; }
.anim-in.anim-in--delay-2 { animation-delay: 0.12s; }
.anim-in.anim-in--delay-3 { animation-delay: 0.18s; }
.anim-in.anim-in--delay-4 { animation-delay: 0.24s; }

.flash { animation: fadeSlideUp 0.3s cubic-bezier(0.22, 1, 0.36, 1) both; }

@keyframes float-reward-up {
	0%   { opacity: 0; transform: translateY(0) scale(0.9); }
	15%  { opacity: 1; transform: translateY(-10px) scale(1.05); }
	80%  { opacity: 1; transform: translateY(-55px) scale(1); }
	100% { opacity: 0; transform: translateY(-80px) scale(0.95); }
}
.float-reward {
	position: fixed;
	top: 72px;
	right: 20px;
	padding: 8px 18px;
	border-radius: var(--radius-pill);
	background: rgba(var(--success-rgb), 0.12);
	border: 1px solid rgba(var(--success-rgb), 0.35);
	color: var(--success);
	font-weight: var(--weight-bold);
	font-size: var(--glyph-size);
	animation: float-reward-up 2.2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
	pointer-events: none;
	z-index: var(--z-toast);
	white-space: nowrap;
}
.float-reward--xp { background: rgba(var(--accent-rgb), 0.12); border-color: rgba(var(--accent-rgb), 0.35); color: var(--accent); }

@keyframes btn-ripple-expand { to { transform: scale(4); opacity: 0; } }
.btn__ripple {
	position: absolute;
	border-radius: 50%;
	width: 40px;
	height: 40px;
	margin-top: -20px;
	margin-left: -20px;
	background: rgba(var(--overlay-white-rgb), 0.28);
	transform: scale(0);
	animation: btn-ripple-expand 0.55s ease-out forwards;
	pointer-events: none;
}

@keyframes card-glow-success {
	0%   { box-shadow: var(--shadow); }
	35%  { box-shadow: var(--shadow), 0 0 0 6px rgba(var(--success-rgb), 0.22); }
	100% { box-shadow: var(--shadow); }
}
.card--action-done { animation: card-glow-success 1.6s ease-out; }

@media (prefers-reduced-motion: reduce) {
	.anim-in, .anim-in.is-visible, .anim-in.anim-in--fade.is-visible, .anim-in.anim-in--scale.is-visible, .flash {
		animation: none !important;
		opacity: 1 !important;
		transform: none !important;
	}
	.btn__ripple { animation: none !important; opacity: 0; }
	.card--action-done { animation: none !important; }
}

/* ══════════════════════════════════════════
   HEADER DE RUBRIQUE (page-hero)
   ══════════════════════════════════════════ */
.page-hero {
	padding: var(--pad-hero);
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-sm);
	position: relative;
}
.page-hero__row { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--gap-lg); flex-wrap: wrap; }
.page-hero__main { min-width: 0; flex: 1 1 260px; }
.page-hero__progress { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; min-width: 200px; flex-shrink: 0; }
.page-hero__progress-label { font-size: var(--text-sm); color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: var(--weight-bold); }
.page-hero__progress-pct { font-size: var(--text-lg); font-weight: var(--weight-bold); color: var(--text); line-height: 1; }
.page-hero__bar-wrap { width: 220px; height: 8px; border-radius: var(--radius-pill); background: rgba(var(--surface-rgb), 0.5); border: 1px solid var(--border); overflow: hidden; }
.page-hero__bar { height: 100%; width: var(--ph-pct, 0%); border-radius: var(--radius-pill); background: var(--accent); transition: width 0.6s ease; }
.page-hero h2 { margin-bottom: 4px; }
.page-hero .subtitle { margin-bottom: 0; }
.page-hero .description { margin-top: 6px; }
.page-hero nav { margin-bottom: 8px; }

.page-hero--banner {
	background: linear-gradient(to bottom, rgba(11, 17, 32, 0.25), rgba(11, 17, 32, 0.55)), url('../../_img/banniere.png') center/cover no-repeat;
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	padding: 56px 24px;
	text-align: center;
	overflow: hidden;
}
.page-hero--banner h2 { font-size: var(--glyph-size); color: #ffffff; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.7), 0 0 4px rgba(0, 0, 0, 0.5); }
.page-hero--banner .subtitle { font-size: var(--text-md); color: rgba(255, 255, 255, 0.9); text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6), 0 0 3px rgba(0, 0, 0, 0.4); }

.section-page { display: grid; gap: var(--gap-lg); }

.page { background: transparent; border: none; box-shadow: none; padding: 0; border-radius: 0; }
.page > h2:first-child { margin-top: 0; }
.page > h2 { display: inline-block; padding-bottom: 8px; margin-bottom: 10px; border-bottom: 2px solid var(--accent); }
.page > .card + .card { margin-top: 0; }

/* ══════════════════════════════════════════
   APP SHELL — menu gauche + topbar + contenu
   ══════════════════════════════════════════ */
.skip-link {
	position: absolute;
	top: -100%;
	left: 0;
	z-index: var(--z-tooltip);
	padding: 0.75rem 1.5rem;
	background: var(--accent);
	color: var(--on-accent);
	font-weight: var(--weight-bold);
	text-decoration: none;
	border-radius: 0 0 0.5rem 0;
}
.skip-link:focus { top: 0; }

.app { display: flex; min-height: 100vh; }

.sidebar {
	width: var(--sidebar-w);
	flex-shrink: 0;
	position: fixed;
	top: 0; left: 0; bottom: 0;
	z-index: var(--z-sidebar);
	background: var(--sidebar-bg);
	border-right: 1px solid var(--sidebar-divider);
	box-shadow: var(--sidebar-shadow);
	display: flex;
	flex-direction: column;
	overflow-y: auto;
	overflow-x: hidden;
	scrollbar-width: thin;
	scrollbar-color: var(--scrollbar-thumb) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: var(--radius-sm); }

.sidebar__header { padding: 20px 18px 12px; border-bottom: 1px solid var(--sidebar-divider); }
.sidebar__brand { display: flex; align-items: center; gap: var(--gap-lg); text-decoration: none; color: var(--sidebar-text-active); }
.sidebar__brand:hover { text-decoration: none; }
.sidebar__logo { font-size: var(--glyph-size); line-height: 1; }
.sidebar__brand-text { display: flex; flex-direction: column; min-width: 0; }
.sidebar__title { font-weight: var(--weight-bold); font-size: var(--text-md); letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__tagline { font-size: var(--text-sm); color: var(--sidebar-text); font-weight: var(--weight-text); margin-top: 1px; }

.sidebar__nav { flex: 1; padding: var(--gap-lg) var(--gap-lg); display: flex; flex-direction: column; gap: var(--gap-sm); }
.sidebar__divider { height: 1px; background: var(--sidebar-divider); margin: 8px 6px; }

.sidebar__link {
	display: flex;
	align-items: center;
	gap: var(--gap-lg);
	padding: 9px 14px;
	border-radius: var(--radius);
	color: var(--sidebar-text);
	text-decoration: none;
	font-size: var(--text-md);
	font-weight: var(--weight-bold);
	white-space: nowrap;
	transition: all 0.2s ease;
	border: none;
	background: transparent;
	cursor: pointer;
	font-family: inherit;
	width: 100%;
	text-align: left;
	position: relative;
}
.sidebar__link[data-section]::before {
	content: '';
	position: absolute;
	left: 0; top: 22%;
	height: 56%;
	width: 3px;
	border-radius: 0 3px 3px 0;
	background: var(--accent);
	opacity: 0;
	transition: opacity 0.2s;
}
.sidebar__link[data-section]:hover::before, .sidebar__link[data-section].is-active::before { opacity: 1; }
.sidebar__link:hover { color: var(--sidebar-text-active); background: var(--sidebar-hover); text-decoration: none; }
.sidebar__link.is-active { color: var(--sidebar-text-active); background: var(--sidebar-active-bg); font-weight: var(--weight-bold); }
.sidebar__link--locked { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.sidebar__link--locked:hover { opacity: 0.45; }

.sidebar__lock-hint {
	margin-left: auto;
	font-size: var(--text-sm);
	white-space: nowrap;
	flex-shrink: 0;
	background: rgba(var(--accent-rgb), 0.12);
	color: var(--accent);
	border-radius: var(--radius-sm);
	padding: 1px 5px;
}
.sidebar__progress { margin-left: auto; font-size: var(--text-sm); white-space: nowrap; flex-shrink: 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.sidebar__progress--done { color: var(--success); }

.sidebar__locked-group { margin: 0 10px 4px; }
.sidebar__locked-summary {
	display: flex;
	align-items: center;
	gap: var(--gap-sm);
	padding: 9px 14px;
	border-radius: var(--radius);
	color: var(--sidebar-text);
	font-size: var(--text-md);
	cursor: pointer;
	list-style: none;
	user-select: none;
	transition: background 0.15s, color 0.15s;
	font-weight: var(--weight-text);
}
.sidebar__locked-summary::-webkit-details-marker { display: none; }
.sidebar__locked-summary::marker { display: none; }
.sidebar__locked-summary:hover { color: var(--sidebar-text-active); background: var(--sidebar-hover); }

.sidebar__locked-count {
	margin-left: auto;
	font-size: var(--text-sm);
	font-weight: var(--weight-bold);
	background: var(--scrollbar-thumb);
	color: var(--sidebar-text);
	padding: 1px 7px;
	border-radius: var(--radius-pill);
	flex-shrink: 0;
}
.sidebar__locked-arrow { font-size: var(--text-sm); color: var(--sidebar-text); flex-shrink: 0; transition: transform 0.2s ease; }
.sidebar__locked-group[open] .sidebar__locked-arrow { transform: rotate(180deg); }
.sidebar__locked-list { padding: 2px 0; }
.sidebar__locked-list .sidebar__link--locked { padding-left: 20px; align-items: flex-start; }
.sidebar__locked-item-body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.sidebar__locked-desc { font-size: var(--text-sm); color: var(--sidebar-text); opacity: .65; line-height: 1.3; white-space: normal; margin-top: 2px; }

.sidebar__badge-alert {
	margin-left: auto;
	width: 8px; height: 8px;
	border-radius: 50%;
	background: var(--success);
	flex-shrink: 0;
	animation: pulse-alert 1.8s ease-in-out infinite;
}
@keyframes pulse-alert { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.65; transform: scale(0.8); } }

.sidebar__icon { width: 22px; text-align: center; font-size: var(--text-md); flex-shrink: 0; }
.sidebar__text { overflow: hidden; text-overflow: ellipsis; }

.sidebar__bottom { padding: 12px 14px 16px; border-top: 1px solid var(--sidebar-divider); display: flex; flex-direction: column; gap: var(--gap-lg); }
.sidebar__lang { display: flex; gap: var(--gap-sm); padding: 0 4px; }
.sidebar__lang-link { color: var(--sidebar-text); text-decoration: none; padding: 5px 12px; border-radius: var(--radius-pill); font-size: var(--text-md); font-weight: var(--weight-bold); transition: all 0.2s ease; border: 1px solid transparent; }
.sidebar__lang-link:hover { color: var(--sidebar-text-active); background: var(--sidebar-hover); text-decoration: none; }
.sidebar__lang-link.is-active { color: var(--sidebar-text-active); background: var(--sidebar-active-bg); }

.app-overlay {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	z-index: var(--z-topbar);
	opacity: 0;
	transition: opacity 0.3s ease;
}
.app-overlay.is-visible { display: block; opacity: 1; }

.app-shell { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; min-width: 0; }

.topbar {
	position: sticky;
	top: 0;
	z-index: var(--z-dropdown);
	background: var(--surface);
	border-bottom: 1px solid var(--border);
	height: var(--topbar-h);
}
.topbar__inner { display: flex; align-items: center; justify-content: space-between; gap: var(--gap-lg); height: 100%; padding: 0 var(--space); max-width: 100%; }
.topbar__left { display: flex; align-items: center; gap: var(--gap-lg); min-width: 0; flex: 1; }

.topbar__toggle {
	display: none;
	flex-direction: column;
	width: 38px; height: 34px;
	border-radius: 8px;
	border: 1px solid var(--border);
	background: transparent;
	cursor: pointer;
	align-items: center;
	justify-content: center;
	gap: var(--gap-sm);
	padding: 7px;
	transition: all 0.2s ease;
	flex-shrink: 0;
}
.topbar__toggle:hover { background: rgba(var(--accent-rgb), 0.06); border-color: rgba(var(--accent-rgb), 0.2); }
.topbar__bar { display: block; width: 100%; height: 2px; background: var(--text); border-radius: 2px; transition: all 0.2s ease; }

.topbar__title { font-size: var(--text-md); font-weight: var(--weight-bold); margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.topbar__right { display: flex; align-items: center; gap: var(--gap-lg); flex-shrink: 0; }

.topbar__theme {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px; height: 36px;
	border-radius: var(--radius-pill);
	border: 1px solid var(--border);
	background: transparent;
	cursor: pointer;
	font-size: var(--text-md);
	line-height: 1;
	padding: 0;
	transition: all 0.25s ease;
}
.topbar__theme:hover { background: rgba(var(--accent-rgb), 0.06); border-color: rgba(var(--accent-rgb), 0.2); transform: rotate(20deg); }

.topbar__resources { display: inline-flex; align-items: center; gap: var(--gap-sm); padding: 5px 12px; border-radius: var(--radius-pill); background: rgba(var(--surface-rgb), 0.5); font-size: var(--text-md); font-weight: var(--weight-bold); color: var(--text); }
.topbar__resource { white-space: nowrap; }
.topbar__resource--cap { color: var(--warning); animation: cap-pulse 2s ease-in-out infinite; }
@keyframes cap-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

.topbar__notif { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 28px; padding: 0 8px; border-radius: var(--radius-pill); background: rgba(var(--accent-rgb), 0.1); color: var(--accent); font-weight: var(--weight-bold); font-size: var(--text-md); text-decoration: none; transition: all 0.2s ease; }
.topbar__notif:hover { background: rgba(var(--accent-rgb), 0.18); text-decoration: none; }

.topbar__user { display: inline-flex; align-items: center; gap: var(--gap-sm); padding: 5px 12px; border-radius: var(--radius-pill); border: 1px solid var(--border); background: var(--surface); font-weight: var(--weight-bold); font-size: var(--text-md); color: var(--text); }
.topbar__username { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.topbar__logout { display: inline-flex; margin: 0; padding: 0; }
.topbar__logout-btn { display: inline-flex; align-items: center; padding: 5px 12px; border-radius: var(--radius-pill); border: 1px solid var(--border); background: transparent; color: var(--muted); font-size: var(--text-md); font-weight: var(--weight-text); cursor: pointer; font-family: inherit; transition: all 0.2s ease; }
.topbar__logout-btn:hover { color: var(--error); border-color: rgba(var(--error-rgb), 0.3); background: rgba(var(--error-rgb), 0.04); }

.content { flex: 1; background: var(--bg); position: relative; }
.content__wrap { position: relative; z-index: 1; max-width: var(--max); margin: 0 auto; padding: var(--pad-content-wrap); }

.app-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 14px var(--space); }
.app-footer__inner { max-width: var(--max); margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--gap-lg); font-size: var(--text-md); color: var(--muted); }
.app-footer__left { display: flex; align-items: center; gap: var(--gap-sm); }
.app-footer__center { display: flex; flex-wrap: wrap; gap: var(--gap-sm); align-items: center; }
.app-footer__right { display: flex; align-items: center; gap: var(--gap-sm); }

.footer-pill { display: inline-flex; align-items: center; gap: var(--gap-sm); padding: 4px 10px; border-radius: var(--radius-pill); border: 1px solid var(--border); background: rgba(var(--surface-rgb), 0.4); color: var(--text); text-decoration: none; font-size: var(--text-md); font-weight: var(--weight-text); transition: all 0.2s ease; }
.footer-pill:hover { background: rgba(var(--accent-rgb), 0.06); border-color: rgba(var(--accent-rgb), 0.15); color: var(--accent); text-decoration: none; }
.footer-email__text { font-size: var(--text-md); }

.nav-link { display: inline-flex; align-items: center; gap: var(--gap-sm); padding: 7px 14px; border-radius: var(--radius-pill); text-decoration: none; color: var(--text); white-space: nowrap; border: 1px solid var(--border); background: transparent; font-weight: var(--weight-text); font-size: var(--text-md); transition: all 0.2s ease; cursor: pointer; font-family: inherit; }
.nav-link:hover { background: rgba(var(--accent-rgb), 0.06); border-color: rgba(var(--accent-rgb), 0.12); color: var(--accent); text-decoration: none; }
.nav-link.is-active { background: rgba(var(--accent-rgb), 0.12); border-color: rgba(var(--accent-rgb), 0.3); color: var(--accent); font-weight: var(--weight-bold); }

.pager { display: flex; flex-wrap: wrap; gap: var(--gap-sm); align-items: center; }

/* ══════════════════════════════════════════
   RESPONSIVE — seul point de rupture du site (900px)
   ══════════════════════════════════════════ */
@media (max-width: 900px) {
	.sidebar { transform: translateX(-100%); transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1); box-shadow: none; }
	.sidebar.is-open { transform: translateX(0); box-shadow: 8px 0 30px rgba(0, 0, 0, 0.3); }
	.app-shell { margin-left: 0; }
	.topbar__toggle { display: inline-flex; }
	.topbar__user { display: none; }
	.topbar__username { display: none; }
	.topbar__resources { padding: 4px 8px; gap: var(--gap-sm); font-size: var(--text-sm); }
	.topbar__right { gap: var(--gap-sm); }
	.topbar__logout-btn { font-size: 0; padding: 6px; width: 32px; height: 32px; border-radius: var(--radius-pill); justify-content: center; }
	.topbar__logout-btn::before { content: '🚪'; font-size: var(--text-md); }
	.topbar__inner { padding: 0 12px; gap: var(--gap-sm); }
	.topbar__left { gap: var(--gap-sm); }
	.content__wrap { padding: 16px 14px; }
	.app-footer__inner { flex-direction: column; text-align: center; }
	.page-hero { padding: 18px 16px; }
	.page-hero__progress { align-items: flex-start; min-width: 0; width: 100%; }
	.page-hero__bar-wrap { width: 100%; }
	.page-hero--banner { padding: 32px 16px; }
	.page-hero--banner h2 { font-size: var(--glyph-size); }
	.ckp__stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.ck__rename-inline.is-open { flex-direction: column; align-items: stretch; }
	.ck__rename-input { max-width: 100%; }
	.ck__timer { flex-direction: column; text-align: center; }
	.zo__animal-actions { flex-direction: column; align-items: stretch; }
	.zo__animal-action { width: 100%; }
	.zo__enc-selector { flex-direction: column; align-items: stretch; }
	.zo__buildings-grid { grid-template-columns: 1fr; }
	.card__header { flex-direction: column; align-items: stretch; }
	.card__actions { justify-content: flex-start; }
	.ex__map-section { overflow-x: auto; -webkit-overflow-scrolling: touch; }
	.ex__map-grid { min-width: 380px; }
	.ex__legend { gap: 6px 10px; font-size: var(--text-sm); }
	.section-page { gap: var(--gap-lg); }
	.grid { grid-template-columns: 1fr; }
}
