/* ---------- Boutons : petites plaques d'or et de verre ---------- */

.bouton {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--surface-haute), var(--surface-basse));
  box-shadow: var(--relief), inset 0 0 0 1px var(--trait), 0 2px 0 rgba(5, 13, 42, 0.12);
  color: var(--encre);
  font: 700 var(--t-13)/1.2 var(--titre);
  cursor: pointer;
  transition: transform 0.16s var(--rebond), box-shadow 0.16s var(--doux);
}
.bouton:hover { transform: translateY(-1px); }
.bouton:active { transform: translateY(1px); }
.bouton:disabled { opacity: 0.45; cursor: default; transform: none; }
.bouton .icone { font-size: 1rem; color: var(--or-3); }
.bouton-plein {
  background: linear-gradient(180deg, var(--or-1), var(--or-3));
  color: #2a1a04;
  box-shadow: var(--relief), 0 2px 0 var(--or-4), 0 8px 18px rgba(184, 135, 47, 0.3);
}
.bouton-plein .icone { color: #2a1a04; }
.bouton-danger { color: var(--rouge); }
.bouton-danger .icone { color: var(--rouge); }

.bouton-icone {
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border: 0;
  border-radius: var(--r-12);
  background: var(--surface-basse);
  box-shadow: inset 0 0 0 1px var(--trait);
  color: var(--encre-2);
  cursor: pointer;
  font-size: 1.05rem;
  transition: transform 0.16s var(--rebond), color 0.16s var(--doux), background 0.16s var(--doux);
}
.bouton-icone:hover { transform: translateY(-1px); color: var(--or-4); }
.bouton-icone:active { transform: translateY(1px); }
.lateral .bouton-icone {
  background: rgba(243, 246, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(220, 180, 92, 0.25);
  color: var(--or-1);
}
.lateral .bouton-icone:hover { background: rgba(220, 180, 92, 0.22); color: var(--or-0); }

/* ---------- Menus ---------- */

.choix { position: relative; display: inline-flex; }
.choix select {
  appearance: none;
  padding: 0.4rem 1.7rem 0.4rem 0.8rem;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--surface-haute), var(--surface-basse));
  box-shadow: var(--relief), inset 0 0 0 1px var(--trait);
  color: var(--encre);
  font: 700 var(--t-12) var(--titre);
  cursor: pointer;
}
.choix::after {
  content: "";
  position: absolute;
  right: 0.6rem;
  top: 50%;
  width: 0.6rem;
  height: 0.6rem;
  translate: 0 -50%;
  rotate: 90deg;
  background: var(--or-3);
  mask: url(../icons/chevron_right_fill.svg) center / contain no-repeat;
  pointer-events: none;
}

/* ---------- Pupitre ---------- */

.course {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
  padding: 0.5rem 0.6rem 0.5rem 0.9rem;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(220, 180, 92, 0.18), rgba(220, 180, 92, 0.3));
  box-shadow: inset 0 0 0 1px rgba(220, 180, 92, 0.5);
  font: 700 var(--t-13) var(--titre);
}
.course .icone { color: var(--or-4); font-size: 1.1rem; }
.course-titre { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.etat {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.45rem;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  background: var(--surface-basse);
  box-shadow: inset 0 0 0 1px var(--trait);
  color: var(--encre-2);
  font: 700 var(--t-12) var(--titre);
  animation: surgit 0.25s var(--rebond);
}
.etat::before {
  content: "";
  width: 0.45rem; height: 0.45rem;
  border-radius: 50%;
  background: currentColor;
  animation: battement 1.2s var(--doux) infinite;
}
@keyframes battement { 50% { opacity: 0.25; transform: scale(0.8); } }
.etat[data-voix="toi"] { color: var(--azur); }
.etat[data-voix="claude"] { color: var(--or-4); }

.saisie {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.45rem;
  border-radius: var(--r-28);
  background: var(--papier);
  box-shadow: var(--relief), inset 0 0 0 1px var(--trait), var(--ombre-douce);
  transition: box-shadow 0.2s var(--doux);
}
.saisie:focus-within { box-shadow: var(--relief), inset 0 0 0 1px var(--or-2), 0 0 0 3px rgba(220, 180, 92, 0.25), var(--ombre-douce); }
.saisie textarea {
  flex: 1;
  min-height: 2.2rem;
  max-height: 12rem;
  padding: 0.45rem 0.4rem;
  border: 0;
  outline: 0;
  resize: none;
  background: none;
  color: var(--encre);
  font: var(--t-16)/1.45 var(--texte);
}
.saisie textarea::placeholder { color: var(--encre-3); }
.saisie textarea.dictee { color: var(--azur); font-weight: 700; }

.micro, .envoyer, .arreter {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.4rem;
  height: 2.4rem;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  transition: transform 0.2s var(--rebond), box-shadow 0.2s var(--doux);
}
.micro {
  background: var(--surface-basse);
  box-shadow: inset 0 0 0 1px var(--trait);
  color: var(--encre-2);
}
.micro:hover { transform: scale(1.06); color: var(--azur); }
.micro[aria-pressed="true"] {
  background: linear-gradient(180deg, var(--velours-3), var(--velours-1));
  color: var(--or-0);
  box-shadow: 0 0 0 5px rgba(47, 111, 208, 0.18);
  animation: respire 1.8s var(--doux) infinite;
}
@keyframes respire { 50% { box-shadow: 0 0 0 10px rgba(47, 111, 208, 0.08); } }
.envoyer {
  background: linear-gradient(180deg, var(--or-1), var(--or-3));
  color: #2a1a04;
  box-shadow: var(--relief), 0 2px 0 var(--or-4);
}
.envoyer:hover { transform: translateY(-2px); }
.envoyer:active { transform: translateY(1px); }
.arreter { background: linear-gradient(180deg, #e07a6f, var(--rouge)); color: #fff; box-shadow: var(--relief), 0 2px 0 #8c2820; }

.bascules { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; padding: 0.6rem 0.6rem 0; }
.bascule {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--encre-2);
  font: 700 var(--t-12) var(--titre);
  cursor: pointer;
}
.bascule .icone { font-size: 1rem; color: var(--encre-3); }
.bascule input {
  appearance: none;
  position: relative;
  width: 2.1rem;
  height: 1.2rem;
  margin: 0;
  border-radius: 999px;
  background: var(--surface-basse);
  box-shadow: inset 0 0 0 1px var(--trait);
  cursor: pointer;
  transition: background 0.25s var(--doux);
}
.bascule input::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: calc(1.2rem - 4px);
  height: calc(1.2rem - 4px);
  border-radius: 50%;
  background: linear-gradient(180deg, #fff, #e9e2d2);
  box-shadow: 0 1px 3px rgba(5, 13, 42, 0.4);
  transition: translate 0.28s var(--rebond);
}
.bascule input:checked { background: linear-gradient(180deg, var(--or-1), var(--or-3)); }
.bascule input:checked::after { translate: 0.9rem 0; }
.bascule input:checked + .icone { color: var(--or-4); }
.bascule input:disabled { opacity: 0.4; }

/* ---------- Feuilles ---------- */

.panneau {
  width: min(34rem, calc(100vw - 3rem));
  max-height: min(42rem, calc(100vh - 4rem));
  padding: 0;
  border: 0;
  border-radius: var(--r-28);
  background: var(--fond);
  color: var(--encre);
  box-shadow: var(--ombre-scene), inset 0 0 0 1px rgba(220, 180, 92, 0.4);
  animation: surgit 0.3s var(--rebond);
}
.panneau-large { width: min(44rem, calc(100vw - 3rem)); }
.panneau[open] { display: flex; flex-direction: column; }
.panneau::backdrop { background: rgba(5, 13, 42, 0.62); backdrop-filter: blur(3px); }
@keyframes surgit { from { opacity: 0; transform: scale(0.94) translateY(10px); } }

.panneau-tete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 1rem 1rem 0.6rem 1.2rem;
  border-bottom: 1px solid var(--trait);
}
.panneau-tete h2 { margin: 0; font: 700 var(--t-20)/1 var(--titre); }
.panneau-pied {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.8rem 1.2rem;
  padding-bottom: max(0.8rem, env(safe-area-inset-bottom));
  border-top: 1px solid var(--trait);
  background: var(--fond);
}
.pied-actions { display: flex; gap: 0.45rem; }
.compteur { color: var(--encre-3); font: 700 var(--t-12) var(--titre); }

.chemin { margin: 0; padding: 0.6rem 1.2rem 0; color: var(--encre-2); font-size: var(--t-12); overflow-wrap: anywhere; }
.chemin code { font: var(--t-12) var(--code); color: var(--or-4); }
.note { margin: 0; color: var(--encre-2); font-size: var(--t-12); line-height: 1.5; }

.liste { flex: 1; margin: 0; padding: 0.6rem 0.8rem; overflow-y: auto; list-style: none; display: grid; gap: 0.3rem; }
.liste button {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 0;
  border-radius: var(--r-16);
  background: var(--papier);
  box-shadow: inset 0 0 0 1px var(--trait);
  color: var(--encre);
  font: var(--t-13) var(--texte);
  text-align: left;
  cursor: pointer;
  transition: transform 0.16s var(--rebond);
}
.liste button:hover { transform: translateX(3px); box-shadow: inset 0 0 0 1px var(--or-2); }
.liste button .icone { color: var(--or-3); font-size: 1.1rem; }
.liste small { display: block; color: var(--encre-3); font-size: var(--t-11); }
.liste .vide { padding: 1rem 0.6rem; color: var(--encre-3); font-size: var(--t-13); }

.recents { display: flex; flex-wrap: wrap; gap: 0.35rem; padding: 0.4rem 1.2rem 0; }
.recents:empty { display: none; }
.recents button {
  padding: 0.25rem 0.7rem;
  border: 0;
  border-radius: 999px;
  background: var(--papier-creux);
  box-shadow: inset 0 0 0 1px var(--trait);
  color: var(--encre);
  font: 700 var(--t-11) var(--titre);
  cursor: pointer;
}
.recents button:hover { box-shadow: inset 0 0 0 1px var(--or-2); }

/* ---------- Formulaires ---------- */

.groupe { display: grid; gap: 0.7rem; padding: 0.7rem 1.2rem 1.2rem; min-height: 0; overflow-y: auto; }
.groupe label { display: grid; gap: 0.3rem; color: var(--encre-2); font: 700 var(--t-12) var(--titre); }
.groupe output { color: var(--encre); font-variant-numeric: tabular-nums; }
.groupe select,
.groupe input[type="text"],
.groupe textarea {
  width: 100%;
  padding: 0.55rem 0.8rem;
  border: 0;
  border-radius: var(--r-16);
  background: var(--papier);
  box-shadow: inset 0 0 0 1px var(--trait);
  color: var(--encre);
  font: var(--t-13) var(--texte);
}
.groupe textarea { min-height: 6.5rem; resize: vertical; line-height: 1.55; }
.groupe textarea:focus, .groupe input:focus, .groupe select:focus { outline: none; box-shadow: inset 0 0 0 1px var(--or-2), 0 0 0 3px rgba(220, 180, 92, 0.22); }
.groupe input[type="range"] { accent-color: var(--or-3); }
.groupe .bouton { justify-self: start; }

.bloc { display: grid; gap: 0.6rem; padding: 0.8rem; border-radius: var(--r-22); background: var(--papier-creux); box-shadow: inset 0 0 0 1px var(--trait); }
.bloc-titre { display: flex; align-items: center; gap: 0.45rem; font: 700 var(--t-13) var(--titre); color: var(--encre); }
.bloc-titre .icone { color: var(--or-3); font-size: 1.1rem; }

/* ---------- Coffre ---------- */

.cles { display: grid; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.cle {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  grid-template-areas: "nom variable suppr" "valeur valeur suppr" "note note suppr";
  gap: 0.35rem 0.45rem;
  padding: 0.6rem;
  border-radius: var(--r-22);
  background: var(--papier-creux);
  box-shadow: inset 0 0 0 1px var(--trait);
}
.cle input {
  min-width: 0;
  padding: 0.4rem 0.6rem;
  border: 0;
  border-radius: 999px;
  background: var(--papier);
  box-shadow: inset 0 0 0 1px var(--trait);
  color: var(--encre);
  font: var(--t-12) var(--texte);
}
.cle input:focus { outline: none; box-shadow: inset 0 0 0 1px var(--or-2); }
.cle .nom { grid-area: nom; }
.cle .variable { grid-area: variable; font-family: var(--code); }
.cle .valeur { grid-area: valeur; font-family: var(--code); }
.cle .note { grid-area: note; }
.cle .bouton-icone { grid-area: suppr; align-self: center; }
.ajout { display: flex; gap: 0.45rem; }
.ajout select { flex: 1; }

/* ---------- Compétences ---------- */

.puces { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.puce {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: var(--papier);
  box-shadow: inset 0 0 0 1px var(--trait);
  color: var(--encre);
  font: 700 var(--t-12) var(--titre);
  cursor: pointer;
  transition: transform 0.16s var(--rebond);
}
.puce:hover { transform: translateY(-1px); }
.puce:has(input:checked) {
  background: linear-gradient(180deg, var(--or-1), var(--or-3));
  color: #2a1a04;
  box-shadow: var(--relief), 0 2px 0 var(--or-4);
}
.puce input { appearance: none; width: 0; height: 0; margin: 0; }
.puce::before {
  content: "";
  width: 0.85em; height: 0.85em;
  background: currentColor;
  mask: url(../icons/check.svg) center / contain no-repeat;
  opacity: 0;
  transition: opacity 0.2s var(--doux);
}
.puce:has(input:checked)::before { opacity: 1; }

/* ---------- Écran d'accès ---------- */

.acces {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(90% 50% at 50% 0%, rgba(31, 84, 158, 0.55), transparent 70%),
    linear-gradient(180deg, var(--velours-1), var(--velours-0));
}
.acces-carte {
  display: grid;
  gap: 0.8rem;
  width: min(21rem, 100%);
  padding: 1.8rem;
  border-radius: var(--r-28);
  background: var(--fond);
  box-shadow: var(--ombre-scene), inset 0 0 0 1px rgba(220, 180, 92, 0.4);
  text-align: center;
  animation: surgit 0.35s var(--rebond);
}
.acces-carte .blason { justify-self: center; width: 4rem; height: 4rem; }
.acces-carte h1 { margin: 0; font: 700 var(--t-20) var(--titre); }
.acces-carte p { margin: 0; color: var(--encre-2); font-size: var(--t-12); }
.acces-carte input {
  padding: 0.75rem;
  border: 0;
  border-radius: var(--r-16);
  background: var(--papier);
  box-shadow: inset 0 0 0 1px var(--trait);
  color: var(--encre);
  font: 700 var(--t-20) var(--code);
  text-align: center;
  letter-spacing: 0.12em;
}
.acces-carte input:focus { outline: none; box-shadow: inset 0 0 0 1px var(--or-2), 0 0 0 3px rgba(220, 180, 92, 0.25); }
.acces-reglage { display: grid; gap: 0.5rem; }
.acces-reglage .note { font-family: var(--code); overflow-wrap: anywhere; }

@media (max-width: 640px) {
  .panneau, .panneau-large {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }
  .panneau-tete { position: sticky; top: 0; z-index: 1; background: var(--fond); padding-top: max(0.9rem, env(safe-area-inset-top)); }
  .panneau-pied { position: sticky; bottom: 0; }
  .bouton-icone { width: 2.5rem; height: 2.5rem; }
  .micro, .envoyer, .arreter { width: 2.9rem; height: 2.9rem; }
  .cle { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "nom suppr" "variable suppr" "valeur valeur" "note note"; }
}
