/* Version simple : pensée d'abord pour le téléphone et la tablette (gros boutons, une seule colonne). */
:root {
  --papier: #faf6ee; --carte: #fffdf8; --encre: #2a2521; --doux: #756b61; --trait: #e3d9c8;
  --accent: #a8481f; --rouge: #b3261e; --ok: #3c7a4a; --ok-fond: #e3f1e6;
  --lecture: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --papier: #1f1b18; --carte: #29231f; --encre: #efe6d8; --doux: #a89c8d; --trait: #3d352e;
    --accent: #e08a5c; --rouge: #f07a70; --ok: #7fc08e; --ok-fond: #223427; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 18px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--papier); color: var(--encre); font-family: var(--ui); line-height: 1.5; }
main { max-width: 34rem; margin: 0 auto;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(2rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left)); }
header { text-align: center; margin-bottom: .5rem; }
h1 { font-family: var(--lecture); font-size: 2rem; margin: .3rem 0 0; }
.doux { color: var(--doux); } .petit { font-size: .85rem; }
#pour, #etat { text-align: center; margin: .2rem 0; }
label { display: block; font-weight: 600; margin: 1.1rem 0 .35rem; }
input, textarea { width: 100%; font: inherit; font-size: 1rem; color: var(--encre); background: var(--carte);
  border: 1px solid var(--trait); border-radius: 12px; padding: .75rem .85rem; }
textarea { font-family: var(--lecture); line-height: 1.55; resize: vertical; }
textarea[readonly] { opacity: .85; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
button { font: inherit; cursor: pointer; touch-action: manipulation; }

.micro { display: flex; flex-direction: column; align-items: center; gap: .6rem; margin: 1.5rem 0 .5rem; }
.rond { width: 9.5rem; height: 9.5rem; border-radius: 50%; border: 0; background: var(--accent); color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem;
  font-size: 1.15rem; font-weight: 700; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.rond #rec-icone { font-size: 2.2rem; line-height: 1; }
.rond.enreg { background: var(--rouge); animation: pouls 1.6s infinite; }
.rond.pause { background: var(--doux); }
@keyframes pouls { 50% { box-shadow: 0 0 0 16px rgba(179,38,30,.15); } }
.compteur { display: flex; align-items: center; gap: .8rem; }
#timer { font-variant-numeric: tabular-nums; font-size: 1.3rem; }
.niveau { width: 7rem; height: .55rem; background: var(--trait); border-radius: 99px; overflow: hidden; }
.niveau i { display: block; height: 100%; width: 0; background: var(--ok); transition: width .1s; }
#attente { min-height: 1.4rem; margin: 0; }

.grand { display: block; width: 100%; margin: 1rem 0; padding: 1rem; border: 0; border-radius: 14px;
  background: var(--accent); color: #fff; font-size: 1.1rem; font-weight: 700; }
.grand:disabled { opacity: .4; }
.ok { background: var(--ok-fond); color: var(--ok); border-radius: 12px; padding: .9rem 1rem; text-align: center; font-weight: 600; }
.ok button { margin-top: .6rem; background: none; border: 1px solid currentColor; color: inherit; border-radius: 999px; padding: .5rem 1.2rem; }

details { margin: 1.5rem 0 1rem; } summary { cursor: pointer; padding: .4rem 0; font-weight: 600; }
#liste { list-style: none; padding: 0; margin: .4rem 0; }
#liste li { background: var(--carte); border: 1px solid var(--trait); border-radius: 12px; padding: .6rem .8rem; margin: .4rem 0; }
#liste li span { display: block; font-size: .85rem; color: var(--doux); }

.toast { position: fixed; left: 1rem; right: 1rem; bottom: max(1rem, env(safe-area-inset-bottom)); background: var(--encre); color: var(--papier);
  padding: .8rem 1rem; border-radius: 12px; z-index: 10; text-align: center; }
.toast.mauvais { background: var(--rouge); color: #fff; }

/* Page du code d'accès */
.acces { text-align: center; padding-top: 3rem; }
.acces input { font-size: 2rem; letter-spacing: .4em; text-align: center; max-width: 14rem; margin: 1rem auto; display: block; }
.acces .erreur { color: var(--rouge); min-height: 1.5rem; }
