/* =====================================================================
   Générateur de mots de passe - feuille de style
   Palette : ambre sur graphite.

   Thème clair / sombre : les couleurs passent par light-dark(), qui suit
   la propriété color-scheme. Par défaut elle suit le système ; l'attribut
   data-theme sur <html> force l'un ou l'autre.
   Polices système uniquement : aucune ressource externe n'est chargée.
   ===================================================================== */

:root {
	color-scheme: light dark;

	--font-sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
	--font-mono: "Cascadia Mono", "SF Mono", ui-monospace, Menlo, Consolas, "Liberation Mono", monospace;

	/* Fonds et textes : gris chauds (clair) / graphite (sombre) */
	--bg:             light-dark(#f4f2ed, #121110);
	--glow:           light-dark(rgb(176 122 28 / .09), rgb(227 173 79 / .06));
	--pattern:        light-dark(rgb(169 116 26 / .32), rgb(227 173 79 / .09));
	--surface:        light-dark(#ffffff, #1b1a18);
	--surface-sunken: light-dark(#f8f6f1, #141312);
	--surface-hover:  light-dark(#f2efe8, #24221f);
	--border:         light-dark(#e6e1d7, #2b2925);
	--border-strong:  light-dark(#d5cec1, #3b3833);
	--text:           light-dark(#1d1b18, #ece8e1);
	--text-muted:     light-dark(#625d55, #a8a299);
	--text-faint:     light-dark(#736d63, #8d867c);

	/* Ambre : cases cochées, curseur, interrupteurs, focus */
	--accent:         light-dark(#a9741a, #e3ad4f);
	--accent-text:    light-dark(#8a5d10, #e3ad4f);
	--accent-soft:    light-dark(rgb(169 116 26 / .08), rgb(227 173 79 / .10));
	--focus-ring:     light-dark(rgb(169 116 26 / .24), rgb(227 173 79 / .26));
	--switch-off:     light-dark(#9a9284, #6e685f);

	/* Bouton principal : graphite en clair, ambre en sombre */
	--primary-bg:     light-dark(#24221e, #e3ad4f);
	--primary-hover:  light-dark(#3a3731, #efc26f);
	--primary-text:   light-dark(#faf7f0, #1c1609);
	/* Logo : fond = bordure des boutons actifs, icône = fond de la page */
	--brand-bg:       var(--accent);
	--brand-fg:       var(--bg);

	/* Mot de passe : nuances discrètes */
	--char-digits:    light-dark(#8f6211, #e8b860);
	--char-special:   light-dark(#53627a, #a3b3c8);

	--danger:         light-dark(#b42318, #f97066);

	/* Robustesse : du rouge au vert */
	--level-1:        light-dark(#c8432f, #ec6a52);
	--level-2:        light-dark(#d9772c, #f09647);
	--level-3:        light-dark(#c99a1e, #e4bd48);
	--level-4:        light-dark(#6f9f3a, #9ccc5c);
	--level-5:        light-dark(#2f8a4f, #55c07d);

	--shadow-color:   light-dark(rgb(48 40 24 / .07), rgb(0 0 0 / .45));
	--toast-bg:       light-dark(#24221e, #ece8e1);
	--toast-text:     light-dark(#faf7f0, #121110);

	--radius-lg: 16px;
	--radius: 10px;
	--control-h: 40px;
	--ease: cubic-bezier(.2, .7, .2, 1);
}

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"]  { color-scheme: dark; }

/* Navigateurs antérieurs à 2024, sans light-dark() : thème clair seul.
   Valeurs identiques à la partie claire ci-dessus. */
@supports not (color: light-dark(#000, #fff)) {
	:root,
	:root[data-theme] {
		color-scheme: light;
		--bg: #f4f2ed;
		--glow: rgb(176 122 28 / .09);
		--pattern: rgb(169 116 26 / .32);
		--surface: #ffffff;
		--surface-sunken: #f8f6f1;
		--surface-hover: #f2efe8;
		--border: #e6e1d7;
		--border-strong: #d5cec1;
		--text: #1d1b18;
		--text-muted: #625d55;
		--text-faint: #736d63;
		--accent: #a9741a;
		--accent-text: #8a5d10;
		--accent-soft: rgb(169 116 26 / .08);
		--focus-ring: rgb(169 116 26 / .24);
		--switch-off: #9a9284;
		--primary-bg: #24221e;
		--primary-hover: #3a3731;
		--primary-text: #faf7f0;
		--char-digits: #8f6211;
		--char-special: #53627a;
		--danger: #b42318;
		--level-1: #c8432f;
		--level-2: #d9772c;
		--level-3: #c99a1e;
		--level-4: #6f9f3a;
		--level-5: #2f8a4f;
		--shadow-color: rgb(48 40 24 / .07);
		--toast-bg: #24221e;
		--toast-text: #faf7f0;
	}

	/* Sans thème sombre, le bouton ne servirait à rien. Sélecteur plus
	   précis que .theme-btn, défini plus bas dans le fichier. */
	.footer .theme-btn { display: none; }
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

body {
	margin: 0;
	min-height: 100vh;
	min-height: 100dvh;
	font: 400 15px/1.5 var(--font-sans);
	color: var(--text);
	background:
		radial-gradient(1000px 520px at 50% -180px, var(--glow), transparent 70%) no-repeat,
		var(--bg);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

/* Motif de fond : dés, cadenas, clés, points d'interrogation et
   astérisques (mot de passe masqué) éparpillés.
   Le SVG sert de masque : sa couleur vient de --pattern, qui suit le
   thème. Fixe, il ne défile pas avec la page.
   Seulement si le navigateur sait appliquer un masque : sinon on
   verrait un voile uni de la couleur du motif sur tout le fond. */
@supports (mask-image: none) or (-webkit-mask-image: none) {
	body::before {
		content: "";
		position: fixed;
		inset: 0;
		z-index: -1;
		pointer-events: none;
		--pattern-img: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='320' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cdefs%3E%3Cpath id='s' d='M0-4v8M-3.46-2l6.92 4M-3.46 2l6.92-4'/%3E%3Cg id='a'%3E%3Cuse href='%23s' x='-15'/%3E%3Cuse href='%23s' x='-5'/%3E%3Cuse href='%23s' x='5'/%3E%3Cuse href='%23s' x='15'/%3E%3C/g%3E%3Cg id='l'%3E%3Cpath d='M-4.5-1v-4a4.5 4.5 0 0 1 9 0v4'/%3E%3Crect x='-7' y='-1' width='14' height='11' rx='2.5'/%3E%3Ccircle cy='4' r='1.4' fill='black' stroke='none'/%3E%3C/g%3E%3Cg id='k'%3E%3Ccircle cx='-8' r='4.5'/%3E%3Cpath d='M-3.5 0H12M8 0v3.5M11.5 0v3'/%3E%3C/g%3E%3Cg id='q'%3E%3Cpath d='M-4-4a4 4 0 1 1 5.8 3.55c-1.1.55-1.8 1.3-1.8 2.45v.8'/%3E%3Ccircle cy='5.6' r='1.4' fill='black' stroke='none'/%3E%3C/g%3E%3Crect id='d' x='-8' y='-8' width='16' height='16' rx='3.5'/%3E%3Cg id='p1' fill='black' stroke='none'%3E%3Ccircle r='1.4'/%3E%3C/g%3E%3Cg id='p2' fill='black' stroke='none'%3E%3Ccircle cx='-4' cy='-4' r='1.4'/%3E%3Ccircle cx='4' cy='4' r='1.4'/%3E%3C/g%3E%3Cg id='p3'%3E%3Cuse href='%23p2'/%3E%3Cuse href='%23p1'/%3E%3C/g%3E%3Cg id='p4' fill='black' stroke='none'%3E%3Ccircle cx='-4' cy='-4' r='1.4'/%3E%3Ccircle cx='4' cy='-4' r='1.4'/%3E%3Ccircle cx='-4' cy='4' r='1.4'/%3E%3Ccircle cx='4' cy='4' r='1.4'/%3E%3C/g%3E%3Cg id='p5'%3E%3Cuse href='%23p4'/%3E%3Cuse href='%23p1'/%3E%3C/g%3E%3Cg id='p6'%3E%3Cuse href='%23p4'/%3E%3Cg fill='black' stroke='none'%3E%3Ccircle cx='-4' r='1.4'/%3E%3Ccircle cx='4' r='1.4'/%3E%3C/g%3E%3C/g%3E%3C/defs%3E%3Cg transform='translate(40 50) rotate(6)'%3E%3Cg transform='translate(-11 0) rotate(-10)'%3E%3Cuse href='%23d'/%3E%3Cuse href='%23p3'/%3E%3C/g%3E%3Cg transform='translate(11 3) rotate(14)'%3E%3Cuse href='%23d'/%3E%3Cuse href='%23p5'/%3E%3C/g%3E%3C/g%3E%3Cuse href='%23a' transform='translate(150 36) rotate(-6)'/%3E%3Cuse href='%23l' transform='translate(252 58) rotate(10)'/%3E%3Cuse href='%23q' transform='translate(105 122) rotate(-12)'/%3E%3Cg transform='translate(212 150) rotate(-14)'%3E%3Cg transform='translate(-11 0) rotate(-10)'%3E%3Cuse href='%23d'/%3E%3Cuse href='%23p6'/%3E%3C/g%3E%3Cg transform='translate(11 3) rotate(14)'%3E%3Cuse href='%23d'/%3E%3Cuse href='%23p2'/%3E%3C/g%3E%3C/g%3E%3Cuse href='%23k' transform='translate(50 198) rotate(-30)'/%3E%3Cuse href='%23a' transform='translate(152 238) rotate(8)'/%3E%3Cg transform='translate(278 252) rotate(4)'%3E%3Cg transform='translate(-11 0) rotate(-10)'%3E%3Cuse href='%23d'/%3E%3Cuse href='%23p4'/%3E%3C/g%3E%3Cg transform='translate(11 3) rotate(14)'%3E%3Cuse href='%23d'/%3E%3Cuse href='%23p1'/%3E%3C/g%3E%3C/g%3E%3Cuse href='%23k' transform='translate(228 296) rotate(20)'/%3E%3Cuse href='%23l' transform='translate(68 288) rotate(-8)'/%3E%3Cuse href='%23q' transform='translate(294 112) rotate(15)'/%3E%3C/svg%3E");
		background-color: var(--pattern);
		-webkit-mask: var(--pattern-img) 0 0 / 320px 320px repeat;
		mask: var(--pattern-img) 0 0 / 320px 320px repeat;
	}
}

[hidden] { display: none !important; }

/* Posée par app.js le temps de restaurer les réglages au chargement. */
.is-loading *, .is-loading *::before, .is-loading *::after { transition: none !important; }

button, input { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }

code {
	font-family: var(--font-mono);
	font-size: .92em;
	padding: .05em .35em;
	border-radius: 5px;
	background: var(--surface-sunken);
	border: 1px solid var(--border);
}

:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
	width: 18px;
	height: 18px;
	flex: none;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* ---------- Mise en page ---------- */

.page {
	max-width: 660px;
	margin: 0 auto;
	padding: 40px 20px 32px;
}

.main {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	padding: 22px;
	box-shadow:
		0 1px 2px var(--shadow-color),
		0 16px 36px -22px var(--shadow-color);
}

/* ---------- Boutons ---------- */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	height: var(--control-h);
	padding: 0 16px;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius);
	background: var(--surface);
	font-size: .9rem;
	font-weight: 550;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color .15s, border-color .15s, color .15s, transform .1s;
}

.btn:hover { background: var(--surface-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn-primary {
	min-width: 112px;
	border-color: var(--primary-bg);
	background: var(--primary-bg);
	color: var(--primary-text);
}

.btn-primary:hover:not(:disabled) {
	border-color: var(--primary-hover);
	background: var(--primary-hover);
}

.icon-btn {
	display: grid;
	place-items: center;
	flex: none;
	width: var(--control-h);
	height: var(--control-h);
	padding: 0;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--surface);
	color: var(--text-muted);
	cursor: pointer;
	transition: background-color .15s, color .15s, border-color .15s;
}

.icon-btn:hover:not(:disabled) {
	background: var(--surface-hover);
	color: var(--text);
}

.icon-btn:disabled { opacity: .4; cursor: not-allowed; }

.icon-btn[aria-pressed="true"] {
	border-color: var(--accent);
	background: var(--accent-soft);
	color: var(--accent);
}

/* Bouton Copier : icône de validation pendant le retour visuel. */
.icon-done { display: none; }
.btn.is-done .icon-idle { display: none; }
.btn.is-done .icon-done { display: block; }

/* ---------- Résultat ---------- */

/* Logo à gauche de la zone du mot de passe, centré verticalement sur elle.
   Carré et icône (cadenas + dé) de taille fixe
   (l'icône ne suit pas le carré). */
.result {
	--brand-size: 58px;
	--brand-icon: 39.56px;
	--brand-gap: 16px;
}

.result-top {
	display: flex;
	align-items: center;
	gap: var(--brand-gap);
}

.brand-mark {
	display: grid;
	place-items: center;
	flex: none;
	width: var(--brand-size);
	height: var(--brand-size);
	border-radius: 14px;
	background: var(--brand-bg);
	color: var(--brand-fg);
}

.brand-mark .icon {
	width: var(--brand-icon);
	height: var(--brand-icon);
	stroke-width: 1.8;
}

/* Chevron du menu Barbatools, colle au logo */
.result-top barba-nav {
	margin-left: calc(4px - var(--brand-gap));
}

.password-box {
	--pw-size: 1.65rem;
	position: relative;
	flex: 1;
	min-width: 0;
	display: flex;
	align-items: center;
	min-height: 96px;
	padding: 20px 22px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--surface-sunken);
}

.password-box[data-size="m"]  { --pw-size: 1.3rem; }
.password-box[data-size="s"]  { --pw-size: 1.1rem; }
.password-box[data-size="xs"] { --pw-size: .925rem; }

.password {
	display: block;
	width: 100%;
	font: 500 var(--pw-size)/1.45 var(--font-mono);
	letter-spacing: .04em;
	overflow-wrap: anywhere;
	word-break: break-all;
	/* Coupure possible avant ou après n'importe quel caractère, ponctuation
	   comprise : des lignes toujours pleines, quel que soit le contenu. */
	line-break: anywhere;
	-webkit-user-select: all;
	user-select: all;
	cursor: text;
}

.ch-digits  { color: var(--char-digits); }
.ch-special { color: var(--char-special); }

/* Avant la première génération : le titre, coupé entre les mots. */
.password-box.is-placeholder .password {
	overflow-wrap: normal;
	word-break: normal;
	line-break: auto;
	-webkit-user-select: text;
	user-select: text;
	cursor: default;
}

.password-box.is-error .password {
	font: 500 .95rem/1.5 var(--font-sans);
	letter-spacing: 0;
	color: var(--danger);
	-webkit-user-select: text;
	user-select: text;
}

/* Étiquette quand on revoit le mot de passe précédent. Toujours en place
   (invisible sinon) pour pouvoir mesurer si le texte passerait dessous. */
.password-tag {
	visibility: hidden;
	position: absolute;
	top: 8px;
	right: 10px;
	padding: 1px 8px;
	border-radius: 999px;
	background: var(--accent-soft);
	color: var(--accent-text);
	font-size: .6875rem;
	font-weight: 650;
	letter-spacing: .06em;
	text-transform: uppercase;
	pointer-events: none;
}

.password-tag.is-visible { visibility: visible; }

/* Place réservée pour l'étiquette, posée par app.js seulement si le texte
   passerait dessous (mot de passe sur plusieurs lignes). Elle ne dépend pas
   de la visibilité de l'étiquette : revoir le précédent ne déplace rien. */
.password-box.reserve-tag { padding-top: 34px; }

.result-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 14px 20px;
	margin-top: 16px;
}

.result.is-empty .strength { display: none; }

/* Pendant le fondu du premier clic (app.js) : pas de transition de couleur. */
.result.is-revealing .result-bar * { transition: none !important; }

.strength {
	display: flex;
	align-items: center;
	gap: 12px;
	min-width: 0;
}

.meter {
	display: flex;
	gap: 4px;
}

.meter span {
	width: 20px;
	height: 6px;
	border-radius: 3px;
	background: var(--border);
	transition: background-color .25s var(--ease);
}

.meter[data-level="1"] span:nth-child(-n+1) { background: var(--level-1); }
.meter[data-level="2"] span:nth-child(-n+2) { background: var(--level-2); }
.meter[data-level="3"] span:nth-child(-n+3) { background: var(--level-3); }
.meter[data-level="4"] span:nth-child(-n+4) { background: var(--level-4); }
.meter[data-level="5"] span:nth-child(-n+5) { background: var(--level-5); }

.strength-text {
	margin: 0;
	font-size: .875rem;
	color: var(--text-muted);
	white-space: nowrap;
}

.strength-text strong {
	margin-right: 8px;
	font-weight: 600;
	color: var(--text);
}

.actions {
	display: flex;
	gap: 8px;
	margin-left: auto;
}

/* ---------- Réglages ---------- */

.settings {
	display: flex;
	flex-direction: column;
	gap: 26px;
}

.field {
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
}

.field-label {
	display: block;
	margin: 0 0 12px;
	padding: 0;
	font-size: .75rem;
	font-weight: 650;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--text-muted);
}

.hint {
	margin: 10px 0 0;
	font-size: .8125rem;
	color: var(--text-faint);
}

.hint.is-warning { color: var(--danger); }

/* Longueur */

.length-row {
	display: flex;
	align-items: center;
	gap: 16px;
}

.input {
	height: var(--control-h);
	padding: 0 12px;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius);
	background: var(--surface-sunken);
	font-family: var(--font-mono);
	font-size: 1rem;
	transition: border-color .15s, box-shadow .15s, opacity .15s;
}

.input:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 3px var(--focus-ring);
}

.input:disabled { opacity: .5; cursor: not-allowed; }

.number {
	flex: none;
	width: 76px;
	text-align: center;
	font-weight: 600;
	-moz-appearance: textfield;
	appearance: textfield;
}

.number::-webkit-outer-spin-button,
.number::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.range {
	--fill: 50%;
	flex: 1;
	min-width: 0;
	height: 24px;
	margin: 0;
	background: transparent;
	-webkit-appearance: none;
	appearance: none;
	cursor: pointer;
}

.range:focus-visible { outline: none; }

.range::-webkit-slider-runnable-track {
	height: 6px;
	border-radius: 3px;
	background: linear-gradient(to right, var(--accent) var(--fill), var(--border-strong) var(--fill));
}

.range::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 20px;
	height: 20px;
	margin-top: -7px;
	border: 2px solid var(--accent);
	border-radius: 50%;
	background: var(--surface);
	box-shadow: 0 1px 3px var(--shadow-color);
	transition: transform .15s var(--ease), box-shadow .15s;
}

.range:active::-webkit-slider-thumb { transform: scale(1.12); }
.range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 5px var(--focus-ring); }

.range::-moz-range-track {
	height: 6px;
	border-radius: 3px;
	background: var(--border-strong);
}

.range::-moz-range-progress {
	height: 6px;
	border-radius: 3px;
	background: var(--accent);
}

.range::-moz-range-thumb {
	width: 16px;
	height: 16px;
	border: 2px solid var(--accent);
	border-radius: 50%;
	background: var(--surface);
	box-shadow: 0 1px 3px var(--shadow-color);
}

.range:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 5px var(--focus-ring); }

/* Puces à cocher */

.chips {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 8px;
}

.chip {
	position: relative;
	display: block;
}

/* La vraie case reste là (clavier, lecteurs d'écran), invisible, par-dessus. */
.chip input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
	z-index: 1;
}

.chip input:disabled { cursor: not-allowed; }

.chip-body {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 2px;
	height: 100%;
	padding: 11px 13px;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius);
	background: var(--surface);
	transition: background-color .15s, border-color .15s, box-shadow .15s, opacity .15s;
}

.chip:hover .chip-body { background: var(--surface-hover); }

.chip-sample {
	font: 600 1rem/1.3 var(--font-mono);
	color: var(--text);
}

.chip-name {
	font-size: .8125rem;
	color: var(--text-muted);
}

/* Pastille cochée : disque ambre dont la coche est découpée (masque),
   ce qui la rend lisible dans les deux thèmes. */
.chip-body::after {
	content: "";
	position: absolute;
	top: 9px;
	right: 9px;
	width: 16px;
	height: 16px;
	background: var(--accent);
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cmask id='m'%3E%3Crect width='16' height='16' fill='white'/%3E%3Cpath d='M4.6 8.3l2.2 2.2 4.6-4.9' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/mask%3E%3Ccircle cx='8' cy='8' r='8' fill='black' mask='url(%23m)'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cmask id='m'%3E%3Crect width='16' height='16' fill='white'/%3E%3Cpath d='M4.6 8.3l2.2 2.2 4.6-4.9' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/mask%3E%3Ccircle cx='8' cy='8' r='8' fill='black' mask='url(%23m)'/%3E%3C/svg%3E") center / contain no-repeat;
	opacity: 0;
	transform: scale(.6);
	transition: opacity .15s, transform .15s var(--ease);
}

.chip input:checked + .chip-body {
	border-color: var(--accent);
	background: var(--accent-soft);
	box-shadow: inset 0 0 0 1px var(--accent);
}

.chip input:checked + .chip-body::after {
	opacity: 1;
	transform: none;
}

.chip input:focus-visible + .chip-body {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

.chip input:disabled + .chip-body {
	opacity: .4;
	border-style: dashed;
	border-color: var(--border-strong);
	background: transparent;
	box-shadow: none;
}

.chip input:disabled + .chip-body::after { opacity: 0; }

/* Variante compacte (premier caractère) */

.chips-compact .chip-body {
	align-items: center;
	justify-content: center;
	padding: 9px 12px;
}

.chips-compact .chip-name {
	font-size: .875rem;
	font-weight: 500;
	color: var(--text);
}

.chips-compact .chip-body::after {
	top: 50%;
	right: 8px;
	width: 14px;
	height: 14px;
	margin-top: -7px;
}

/* Interrupteurs */

.option {
	display: flex;
	align-items: flex-start;
	gap: 14px;
	padding: 12px 0;
	cursor: pointer;
}

.option:first-of-type { padding-top: 0; }
.option + .option { border-top: 1px solid var(--border); }

.switch {
	position: relative;
	flex: none;
	width: 38px;
	height: 22px;
	margin-top: 1px;
}

.switch input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
	z-index: 1;
}

.switch-track {
	position: absolute;
	inset: 0;
	border-radius: 999px;
	background: var(--switch-off);
	transition: background-color .2s var(--ease);
}

.switch-track::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 2px rgb(0 0 0 / .3);
	transition: transform .2s var(--ease);
}

.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }

.switch input:focus-visible + .switch-track {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

.option-text {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.option-title {
	font-weight: 550;
}

.option-desc {
	font-size: .8125rem;
	color: var(--text-muted);
}

.option-desc code { font-size: .85em; }

/* Caractères spéciaux */

.specials {
	padding-top: 14px;
	border-top: 1px solid var(--border);
}

.specials .option-title { display: block; margin-bottom: 8px; }

.input-group {
	display: flex;
	gap: 8px;
}

.input-group .input {
	flex: 1;
	min-width: 0;
	letter-spacing: .08em;
}

/* ---------- Pied de page ---------- */

.footer {
	margin-top: 28px;
	text-align: center;
	font-size: .8125rem;
	color: var(--text-faint);
}

.footer p { margin: 0 auto; max-width: 520px; }

.footer code {
	padding: 0;
	border: 0;
	background: none;
	color: var(--text-muted);
}

/* Changement de thème : discret, en bas de page. */
.theme-btn {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	margin-top: 14px;
	padding: 5px 12px;
	border: 1px solid transparent;
	border-radius: 999px;
	background: none;
	color: var(--text-faint);
	font-size: .8125rem;
	cursor: pointer;
	transition: color .15s, border-color .15s, background-color .15s;
}

.theme-btn:hover {
	border-color: var(--border);
	background: var(--surface);
	color: var(--text);
}

.theme-btn .icon { width: 15px; height: 15px; }

/* ---------- Notification ---------- */

.toast {
	position: fixed;
	left: 50%;
	bottom: 24px;
	z-index: 10;
	max-width: calc(100vw - 32px);
	padding: 10px 18px;
	border-radius: 999px;
	background: var(--toast-bg);
	color: var(--toast-text);
	font-size: .875rem;
	font-weight: 550;
	box-shadow: 0 10px 30px -10px rgb(0 0 0 / .45);
	opacity: 0;
	transform: translate(-50%, 12px);
	pointer-events: none;
	transition: opacity .2s, transform .25s var(--ease);
}

.toast.is-visible {
	opacity: 1;
	transform: translate(-50%, 0);
}

.toast[data-kind="error"] {
	background: var(--danger);
	color: #fff;
}

/* ---------- Petits écrans ---------- */

@media (max-width: 560px) {
	.page { padding: 16px 16px 28px; }
	.card { padding: 18px; }
	.result { --brand-size: 42px; --brand-icon: 29.44px; --brand-gap: 10px; }
	.brand-mark { border-radius: 12px; }
	.password-box { min-height: 80px; padding: 14px; --pw-size: 1.15rem; }
	.password-box[data-size="m"] { --pw-size: 1rem; }
	.password-box[data-size="s"] { --pw-size: .9rem; }
	.password-box[data-size="xs"] { --pw-size: .8rem; }
	.chips { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.result-bar { flex-direction: column; align-items: stretch; }
	.actions { margin-left: 0; }
	.actions .btn { flex: 1; }
}

/* ---------- Mouvements réduits ---------- */

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after {
		transition-duration: .01ms !important;
		animation-duration: .01ms !important;
	}
}
