/* SimulArduino — styles */
:root {
  --fond: #eef1f4;
  --surface: #ffffff;
  --texte: #1c2530;
  --texte-doux: #5c6b7a;
  --bord: #d5dce3;
  --nuit: #16212c;
  --nuit-2: #22303d;
  --accent: #0e7c86;
  --accent-clair: #e3f3f4;
  --orange: #f08a1c;
  --rouge: #c8372d;
  --vert: #2b9348;
  --rayon: 8px;
  --police: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "Fira Code", "DejaVu Sans Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--police); color: var(--texte); background: var(--fond); font-size: 14px; }
button, .bouton, input, select { font: inherit; }
button, .bouton {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 6px;
  border: 1px solid var(--bord); background: var(--surface); color: var(--texte); cursor: pointer; text-decoration: none;
  white-space: nowrap; line-height: 1.3;
}
button:hover:not(:disabled), .bouton:hover { border-color: var(--accent); color: var(--accent); }
button:disabled { opacity: .4; cursor: default; }
button.principal { background: var(--accent); border-color: var(--accent); color: #fff; }
button.principal:hover:not(:disabled) { background: #0b6870; color: #fff; }
button.danger { color: var(--rouge); }
button.danger:hover:not(:disabled) { border-color: var(--rouge); color: var(--rouge); }
input[type=text], input[type=number], select { padding: 6px 8px; border: 1px solid var(--bord); border-radius: 6px; background: #fff; color: var(--texte); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- barre du haut ---------- */
.barre-haut { display: flex; align-items: center; gap: 14px; padding: 0 16px; height: 54px; background: var(--nuit); color: #fff; }
.logo { display: flex; align-items: center; gap: 9px; color: #fff; text-decoration: none; font-size: 18px; letter-spacing: .2px; }
.logo svg { width: 30px; height: 30px; }
.logo b { color: #ffb347; font-weight: 700; }
.sous-titre { color: #9fb0bf; }
.nom-circuit { background: var(--nuit-2); border: 1px solid transparent; color: #fff; border-radius: 6px; padding: 6px 10px; min-width: 220px; }
.nom-circuit:hover, .nom-circuit:focus { border-color: #4a5d6e; }
.etat-sauvegarde { font-size: 12.5px; color: #9fb0bf; }
.etat-sauvegarde.non-enregistre { color: #ffcf7a; }
.etat-sauvegarde.enregistre { color: #8fd6a6; }
.etat-sauvegarde.erreur { color: #ff8f86; }
.actions-haut { margin-left: auto; display: flex; gap: 8px; }
.barre-haut button, .barre-haut .bouton { background: var(--nuit-2); border-color: #3a4b5b; color: #e8eef3; }
.barre-haut button.principal { background: var(--accent); border-color: var(--accent); }
.barre-haut button:hover:not(:disabled), .barre-haut .bouton:hover { color: #fff; border-color: #6c8394; }

/* ---------- page liste ---------- */
.contenu-liste { max-width: 1180px; margin: 0 auto; padding: 24px 16px 60px; }
.bandeau { display: flex; gap: 32px; justify-content: space-between; align-items: center; flex-wrap: wrap;
  background: linear-gradient(120deg, #0e7c86, #145f86); color: #fff; padding: 28px; border-radius: 14px; margin-bottom: 28px; }
.bandeau h1 { margin: 0 0 8px; font-size: 26px; }
.bandeau p { margin: 0; max-width: 560px; color: #d8eef0; line-height: 1.5; }
.actions-bandeau { display: flex; flex-direction: column; gap: 10px; min-width: 300px; }
.form-nouveau { display: flex; gap: 8px; }
.form-nouveau input { flex: 1; border: none; }
.bandeau .bouton { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .35); color: #fff; justify-content: center; }
.bandeau button.principal { background: var(--orange); border-color: var(--orange); }
h2 { font-size: 18px; margin: 28px 0 14px; display: flex; align-items: center; gap: 8px; }
.compte { background: var(--accent-clair); color: var(--accent); border-radius: 20px; padding: 1px 9px; font-size: 13px; }
.grille-cartes { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.carte { background: var(--surface); border: 1px solid var(--bord); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.carte .apercu { display: block; height: 170px; background: #f6f8fa radial-gradient(#d7dee5 0.8px, transparent 0.8px) 0 0 / 12px 12px; border-bottom: 1px solid var(--bord); }
.carte .apercu svg { width: 100%; height: 100%; }
.carte .infos { padding: 12px 14px 4px; flex: 1; }
.carte h3 { margin: 0 0 4px; font-size: 15.5px; }
.carte h3 a { color: inherit; text-decoration: none; }
.carte p { margin: 0; color: var(--texte-doux); font-size: 13px; line-height: 1.45; }
.actions-carte { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px 14px; }
.actions-carte form { margin: 0; }
.actions-carte button, .actions-carte .bouton { padding: 4px 10px; font-size: 13px; }
.vide { color: var(--texte-doux); }
.messages { margin-bottom: 16px; }
.message { padding: 10px 14px; border-radius: 8px; background: var(--accent-clair); margin: 0 0 8px; }
.message.error { background: #fde8e6; color: #8f241c; }
.message.success { background: #e5f5ea; color: #1d6b36; }

/* ---------- éditeur ---------- */
.page-editeur { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.barre-outils { display: flex; align-items: center; gap: 6px; padding: 6px 12px; background: var(--surface); border-bottom: 1px solid var(--bord); flex-wrap: wrap; }
.barre-outils .groupe { display: flex; align-items: center; gap: 4px; padding-right: 8px; margin-right: 4px; border-right: 1px solid var(--bord); }
.outil { width: 34px; height: 32px; justify-content: center; padding: 0; font-size: 16px; }
.outil.large { width: auto; padding: 0 10px; font-size: 13px; }
.outil.petit { width: 28px; height: 24px; font-size: 13px; }
.espaceur { flex: 1; }
#btn-code.actif { background: var(--accent-clair); border-color: var(--accent); color: var(--accent); }
.simuler { background: var(--vert); border-color: var(--vert); color: #fff; font-weight: 600; padding: 7px 14px; }
.simuler:hover:not(:disabled) { background: #237a3b; color: #fff !important; }
.en-simulation .simuler { background: var(--rouge); border-color: var(--rouge); }
.simuler .icone { font-size: 12px; }
.pastilles { display: flex; gap: 4px; flex-wrap: wrap; }
.pastille { width: 20px; height: 20px; padding: 0; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #aab4be; }
.pastille.active { box-shadow: 0 0 0 2px var(--accent); }

.espace { flex: 1; display: flex; min-height: 0; }
.palette { width: 220px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--bord); overflow-y: auto; padding: 10px 12px; }
.palette h2 { margin: 2px 0 6px; font-size: 15px; }
.palette h3 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--texte-doux); margin: 14px 0 6px; }
.grille-palette { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.element-palette { min-width: 0; flex-direction: column; justify-content: center; gap: 4px; height: 84px; padding: 6px 4px; font-size: 11.5px; white-space: normal; text-align: center; touch-action: none; user-select: none; }
.element-palette svg { width: 100%; height: 50px; pointer-events: none; }
.element-palette:hover:not(:disabled) { background: var(--accent-clair); }
.aide-palette { color: var(--texte-doux); font-size: 12px; line-height: 1.45; margin-top: 16px; }

.zone-toile { flex: 1; position: relative; min-width: 0; background: #f7f9fb; }
#toile { width: 100%; height: 100%; display: block; touch-action: none; user-select: none; cursor: default; }
.point-grille { fill: #b9c3cc; }
.en-simulation .zone-toile { background: #f2f7f3; }
.comp { cursor: move; }
.en-simulation .comp { cursor: default; }
.en-simulation .comp-bouton, .en-simulation .comp-potentiometre, .en-simulation .comp-photoresistance { cursor: pointer; }
.comp.fantome { opacity: .6; pointer-events: none; }
.cadre-selection { fill: none; stroke: var(--accent); stroke-width: 1.2; stroke-dasharray: 5 3; pointer-events: none; }
.broche { fill: transparent; stroke: transparent; stroke-width: 1.4; cursor: crosshair; }
.broche:hover { fill: rgba(240, 138, 28, .35); stroke: var(--orange); }
.broche.contact { fill: rgba(43, 147, 72, .55); }
.en-simulation .broche { cursor: help; }
.masque { display: none; }
.fil { cursor: pointer; }
.fil-clic { stroke: transparent; stroke-width: 10; fill: none; }
.fil-contour { stroke-width: 4.4; fill: none; stroke-linejoin: round; stroke-linecap: round; pointer-events: none; }
.fil-ame { stroke-width: 3; fill: none; stroke-linejoin: round; stroke-linecap: round; pointer-events: none; }
.fil.choisi .fil-contour { stroke: var(--accent) !important; stroke-width: 6.5; }
.fil-bout { pointer-events: none; }
.poignee { fill: #fff; stroke: var(--accent); stroke-width: 1.6; cursor: grab; }
.poignee.bout { fill: var(--accent-clair); }
#fil-en-cours { pointer-events: none; }

.inspecteur { position: absolute; top: 12px; right: 12px; width: 240px; background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon);
  box-shadow: 0 6px 20px rgba(20, 35, 50, .12); padding: 12px 14px; }
.inspecteur h4 { margin: 0; font-size: 14.5px; }
.inspecteur .identifiant { color: var(--texte-doux); font-size: 12px; margin-bottom: 8px; font-family: var(--mono); }
.inspecteur .champ { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; font-size: 12.5px; color: var(--texte-doux); }
.inspecteur .champ select, .inspecteur .champ input { color: var(--texte); }
.inspecteur .ohms { display: flex; gap: 6px; }
.inspecteur .ohms input { flex: 1; min-width: 0; }
.inspecteur output { font-size: 12px; color: var(--texte); }
.inspecteur .aide { font-size: 12px; color: var(--texte-doux); line-height: 1.4; margin: 8px 0 0; }
.inspecteur .pastilles { margin-top: 10px; }
.actions-inspecteur { display: flex; gap: 6px; margin-top: 12px; }
.actions-inspecteur button { flex: 1; justify-content: center; font-size: 13px; padding: 5px 8px; }
.infobulle { position: absolute; pointer-events: none; background: var(--nuit); color: #fff; font-size: 12px; padding: 4px 8px; border-radius: 5px; white-space: nowrap; z-index: 5; }
.barre-etat { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 12px; padding: 5px 12px;
  background: rgba(255, 255, 255, .92); border-top: 1px solid var(--bord); font-size: 12.5px; color: var(--texte-doux); font-family: var(--mono); }
.en-simulation #etat-sim { color: var(--vert); font-weight: 600; }
.alertes { flex: 1; display: flex; gap: 6px; overflow-x: auto; font-family: var(--police); }
.alerte { background: #fff4d6; border-color: #f0c34a; color: #7a5400; font-size: 12px; padding: 2px 8px; }

/* ---------- code ---------- */
.panneau-code { width: 42%; max-width: 640px; min-width: 340px; display: flex; flex-direction: column; background: #fbfcfd; border-left: 1px solid var(--bord); }
.panneau-code[hidden] { display: none; }
.entete-code { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--bord); font-weight: 600; background: var(--surface); }
.entete-code small { color: var(--texte-doux); font-weight: 400; }
.carte-cible { font-weight: 400; font-size: 12.5px; color: var(--texte-doux); border: 1px solid var(--bord); border-radius: 20px; padding: 2px 10px; }
.erreur-code { background: #fde8e6; color: #8f241c; padding: 8px 12px; font-size: 13px; border-bottom: 1px solid #f3c2bd; line-height: 1.4; }
.editeur-code { flex: 1; display: flex; min-height: 0; font-family: var(--mono); font-size: 13.5px; line-height: 20px; }
.gouttiere { width: 46px; flex-shrink: 0; overflow: hidden; text-align: right; padding: 10px 8px 10px 0; color: #9aa8b5; background: #f1f4f7; border-right: 1px solid var(--bord); user-select: none; }
.gouttiere div { height: 20px; }
.gouttiere .ligne-erreur { color: #fff; background: var(--rouge); border-radius: 0 3px 3px 0; }
.zone-saisie { position: relative; flex: 1; min-width: 0; }
.surlignage, #zone-code { position: absolute; inset: 0; margin: 0; padding: 10px 12px; border: 0; font: inherit; line-height: 20px; white-space: pre; overflow: auto; tab-size: 2; }
.surlignage { pointer-events: none; color: #24323f; overflow: hidden; }
#zone-code { background: transparent; color: transparent; caret-color: #111; resize: none; outline: none; }
#zone-code::selection { background: rgba(14, 124, 134, .25); }
.barre-erreur { position: absolute; left: 0; right: 0; background: rgba(200, 55, 45, .12); border-left: 3px solid var(--rouge); pointer-events: none; }
.surlignage .com { color: #8a96a3; font-style: italic; }
.surlignage .chn { color: #a5541f; }
.surlignage .pre { color: #7b4fb8; }
.surlignage .nbr { color: #0a7f6f; }
.surlignage .mot { color: #3459c7; font-weight: 600; }
.surlignage .fn { color: #b5306b; }
.surlignage .cst { color: #0e7c86; font-weight: 600; }

.moniteur { border-top: 1px solid var(--bord); background: var(--surface); display: flex; flex-direction: column; height: 34%; min-height: 120px; }
.moniteur.replie { height: auto; min-height: 0; }
.moniteur.replie .sortie-serie, .moniteur.replie .envoi-serie { display: none; }
.entete-moniteur { display: flex; justify-content: space-between; padding: 4px 8px; }
button.lien { border: none; background: none; padding: 4px 6px; color: var(--accent); font-weight: 600; }
.sortie-serie { flex: 1; margin: 0; padding: 6px 12px; overflow: auto; font-family: var(--mono); font-size: 12.5px; background: #0f1a24; color: #c6f6d5; white-space: pre-wrap; word-break: break-all; }
.envoi-serie { display: flex; gap: 6px; padding: 6px 8px; }
.envoi-serie input { flex: 1; min-width: 0; }

@media (max-width: 900px) {
  .palette { width: 150px; }
  .grille-palette { grid-template-columns: minmax(0, 1fr); }
  .panneau-code { position: absolute; right: 0; top: 100px; bottom: 0; z-index: 10; width: 92%; min-width: 0; }
  .nom-circuit { min-width: 0; width: 140px; }
  .etat-sauvegarde { display: none; }
}

/* ---------- comptes ---------- */
.menu-compte { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.actions-haut + .menu-compte { margin-left: 8px; padding-left: 12px; border-left: 1px solid #3a4b5b; }
.menu-compte form { margin: 0; }
.menu-compte .utilisateur { display: flex; align-items: center; gap: 8px; color: #fff; font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.menu-compte .avatar { width: 28px; height: 28px; border-radius: 50%; background: #ffb347; color: var(--nuit); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.menu-compte .nom-utilisateur { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.barre-haut .menu-compte button, .barre-haut .menu-compte .bouton { padding: 5px 10px; font-size: 13px; }
.carte-compte { max-width: 420px; margin: 48px auto; padding: 28px 30px; background: var(--surface); border: 1px solid var(--bord); border-radius: 14px; box-shadow: 0 8px 28px rgba(20, 35, 50, .08); }
.carte-compte h1 { margin: 0 0 6px; font-size: 22px; }
.carte-compte .intro { margin: 0 0 20px; color: var(--texte-doux); line-height: 1.45; }
.champ-form { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.champ-form label { font-weight: 600; font-size: 13.5px; }
.champ-form input { padding: 9px 10px; border: 1px solid var(--bord); border-radius: 7px; font: inherit; }
.champ-form.en-erreur input { border-color: var(--rouge); }
.erreur-champ, .erreurs-form p { color: var(--rouge); font-size: 13px; margin: 0; }
.erreurs-form { background: #fde8e6; border-radius: 7px; padding: 8px 12px; margin-bottom: 14px; }
.aide-champ { color: var(--texte-doux); font-size: 12px; line-height: 1.4; }
.aide-champ ul { margin: 4px 0 0; padding-left: 18px; }
button.large { width: 100%; justify-content: center; padding: 10px; font-weight: 600; margin-top: 4px; }
.bascule { text-align: center; margin: 18px 0 0; color: var(--texte-doux); }
.bascule a { color: var(--accent); font-weight: 600; }
@media (max-width: 900px) { .menu-compte .nom-utilisateur { display: none; } }
.form-google { margin: 0; }
.bouton-google { width: 100%; justify-content: center; gap: 10px; padding: 10px; font-weight: 600; background: #fff; border-color: #c9d1d9; }
.bouton-google svg { width: 20px; height: 20px; }
.separateur { display: flex; align-items: center; gap: 10px; color: var(--texte-doux); font-size: 13px; margin: 18px 0; }
.separateur::before, .separateur::after { content: ""; flex: 1; height: 1px; background: var(--bord); }
.carte-compte .messages p { margin: 0 0 10px; }
.carte-compte form button[type=submit]:not(.bouton-google) { margin-top: 6px; }
.carte-compte a.retour { display: inline-block; margin-top: 16px; color: var(--accent); font-weight: 600; }
.zone-google { display: flex; flex-direction: column; align-items: center; min-height: 44px; }
.zone-google .g_id_signin { width: 100%; display: flex; justify-content: center; }
.zone-google .form-google { width: 100%; }
.google-a-configurer { border: 1.5px dashed #c9d1d9; border-radius: 8px; padding: 10px 12px; margin-bottom: 18px; font-size: 12.5px; color: var(--texte-doux); line-height: 1.45; }
.google-a-configurer strong { display: block; color: var(--texte); margin-bottom: 2px; }
.google-a-configurer code { font-size: 11.5px; background: #f1f4f7; padding: 0 3px; border-radius: 3px; }

/* ---------- à propos ---------- */
.menu-compte .lien-info { color: #cfe0ea; font-size: 19px; text-decoration: none; line-height: 1; padding: 2px 4px; border-radius: 50%; }
.menu-compte .lien-info:hover { color: #ffb347; }
.infos-apropos { display: grid; grid-template-columns: max-content 1fr; gap: 10px 18px; margin: 0 0 22px; padding: 16px 18px; background: #f6f8fa; border: 1px solid var(--bord); border-radius: 10px; }
.infos-apropos dt { color: var(--texte-doux); font-size: 13.5px; }
.infos-apropos dd { margin: 0; font-weight: 600; }
.infos-apropos a, .pied-page a, .pied-apropos a { color: var(--accent); }
.bouton-tiktok { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 11px; border-radius: 8px; background: #111; color: #fff; font-weight: 600; text-decoration: none; }
.bouton-tiktok:hover { background: #000; box-shadow: -2px -2px 0 #25f4ee, 2px 2px 0 #fe2c55; }
.bouton-tiktok svg { width: 20px; height: 20px; }
.pied-apropos { text-align: center; margin: 14px 0 0; font-size: 12.5px; color: var(--texte-doux); }
.pied-page { margin-top: 48px; padding-top: 18px; border-top: 1px solid var(--bord); text-align: center; color: var(--texte-doux); font-size: 13px; line-height: 1.7; }

/* ---------- téléphone ---------- */
.menu-haut { display: contents; }
.btn-menu, .btn-palette, .fermer-panneau { display: none; }

@media (max-width: 700px) {
  /* En-têtes */
  .barre-haut { gap: 8px; padding: 0 10px; position: relative; }
  .logo span, .sous-titre { display: none; }
  .menu-compte { gap: 6px; }
  .menu-compte .lien-info { font-size: 20px; }
  .barre-haut .menu-compte button, .barre-haut .menu-compte .bouton { padding: 5px 8px; }
  .menu-compte .bouton[href*="admin"] { display: none; }

  /* Accueil */
  .contenu-liste { padding: 14px 12px 40px; }
  .bandeau { padding: 18px; gap: 16px; border-radius: 12px; margin-bottom: 18px; }
  .bandeau h1 { font-size: 21px; }
  .actions-bandeau { min-width: 0; width: 100%; }
  .form-nouveau { flex-direction: column; }
  .form-nouveau input { padding: 10px; }
  .bandeau .bouton, .bandeau button { justify-content: center; padding: 9px 12px; }
  .grille-cartes { grid-template-columns: minmax(0, 1fr); }
  .carte .apercu { height: 190px; }
  .actions-carte button, .actions-carte .bouton { padding: 7px 12px; }

  /* Comptes / à propos */
  .carte-compte { margin: 16px 12px; padding: 20px 18px; }
  .infos-apropos { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .infos-apropos dd { margin-bottom: 8px; overflow-wrap: anywhere; }

  /* Éditeur : barre du haut, actions dans un menu */
  .page-editeur { height: 100dvh; }
  .page-editeur .nom-circuit { flex: 1; min-width: 0; width: auto; }
  .page-editeur .etat-sauvegarde { display: block; flex-shrink: 0; width: 12px; height: 12px; border-radius: 50%; background: #9fb0bf; font-size: 0; overflow: hidden; }
  .page-editeur .etat-sauvegarde.enregistre { background: #4cc77a; }
  .page-editeur .etat-sauvegarde.non-enregistre { background: #ffb347; }
  .page-editeur .etat-sauvegarde.erreur { background: #ff6b5f; }
  .btn-menu { display: inline-flex; font-size: 20px; padding: 3px 10px; }
  .page-editeur .menu-haut { display: none; }
  .menu-ouvert .menu-haut { display: flex; flex-direction: column; align-items: stretch; gap: 10px; position: absolute; top: 100%; right: 8px; left: 8px; z-index: 40;
    padding: 12px; background: var(--nuit); border-radius: 0 0 10px 10px; box-shadow: 0 10px 24px rgba(0, 0, 0, .3); }
  .menu-ouvert .actions-haut { margin: 0; flex-direction: column; gap: 8px; }
  .menu-ouvert .actions-haut button, .menu-ouvert .actions-haut .bouton { justify-content: center; padding: 10px; }
  .menu-ouvert .menu-compte { margin: 0; padding: 10px 0 0; border-left: none; border-top: 1px solid #3a4b5b; justify-content: space-between; }
  .menu-ouvert .menu-compte .nom-utilisateur { display: inline; }
  .menu-ouvert .menu-compte .bouton[href*="admin"] { display: inline-flex; }

  /* Barre d'outils sur une ligne qui défile */
  .barre-outils { flex-wrap: nowrap; overflow-x: auto; padding: 6px 8px; gap: 4px; scrollbar-width: none; }
  .barre-outils::-webkit-scrollbar { display: none; }
  .barre-outils > * { flex-shrink: 0; }
  .barre-outils .groupe { padding-right: 4px; margin-right: 2px; }
  .pastilles { flex-wrap: nowrap; }
  .outil { width: 38px; height: 36px; }
  .btn-palette { display: inline-flex; background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; height: 36px; }
  .btn-palette { order: -3; }
  #btn-code { order: -2; }
  .simuler { order: -1; margin-right: 4px; }
  .espaceur { display: none; }
  .simuler .texte { display: none; }
  .simuler { width: 44px; height: 36px; justify-content: center; padding: 0; }
  #btn-code { height: 36px; }

  /* Palette en tiroir, code en plein écran */
  .espace { position: relative; }
  .palette { position: absolute; left: 0; top: 0; bottom: 0; z-index: 30; width: min(320px, 86vw); transform: translateX(-105%);
    transition: transform .2s ease; box-shadow: 6px 0 24px rgba(20, 35, 50, .2); }
  .palette-ouverte .palette { transform: none; }
  .palette h2 { display: flex; justify-content: space-between; align-items: center; }
  .grille-palette { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fermer-panneau { display: inline-flex; padding: 4px 10px; font-size: 15px; }
  .aide-palette { display: none; }
  .panneau-code { position: absolute; inset: 0; z-index: 25; width: 100%; max-width: none; min-width: 0; border-left: none; }
  .entete-code { gap: 8px; }
  .entete-code .carte-cible { display: none; }
  .moniteur { height: 38%; }
  .envoi-serie select { max-width: 120px; }

  /* Inspecteur en bas de l'écran */
  .inspecteur { top: auto; left: 8px; right: 8px; bottom: 36px; width: auto; max-height: 48%; overflow-y: auto; z-index: 20; }
  .barre-etat { font-size: 11.5px; padding: 4px 8px; gap: 8px; }
  #etat-sim { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
}

/* Écrans tactiles : broches plus faciles à toucher */
@media (pointer: coarse) {
  .broche { stroke-width: 9; }
  .broche:hover { stroke: transparent; }
}
