/* Compteur de mailles (cap555.eu) — même look que le compteur d'Adèle (04/12/2026) :
   vert sapin qui s'illumine et passe au rouge vers le bas, titre et pelote orangés ;
   décor de Noël (boules rouges et or) jusqu'au 6 janvier 2027, classe .noel sur <html>. */
* { box-sizing: border-box; margin: 0; }
:root {
  --texte: #F2FBE8;
  --vert-clair: #C6F36E;
  --sapin-bouton: #0F4A2C;
  --sapin-bouton-survol: #156038;
  --carte: rgba(255, 255, 255, .06);
  --bord: rgba(198, 243, 110, .2);
  --fond-menu: #0D3524;
  color-scheme: dark;
}
html { background: #08251A; }
body { min-height: 100dvh; font-family: system-ui, "DejaVu Sans", sans-serif; color: var(--texte);
  background: radial-gradient(ellipse 90% 55% at 50% 112%, rgba(255, 96, 72, .55), transparent 70%),
              radial-gradient(ellipse 60% 40% at 50% 55%, rgba(95, 216, 107, .16), transparent 70%),
              radial-gradient(ellipse 45% 30% at 12% 6%, rgba(198, 243, 110, .12), transparent 70%),
              linear-gradient(180deg, #08251A 0%, #0D3524 30%, #1E3A22 52%, #4A2A1C 74%, #7E1E20 90%, #9E1C22 100%) fixed;
  display: grid; grid-template-rows: 1fr auto; }

#compteur { display: grid; grid-template-rows: auto 1fr auto; gap: 16px; padding: 26px 34px 18px; min-width: 0; }
.k-haut { display: flex; align-items: center; gap: 14px; }
.k-haut h1 { font-size: 1.9rem; font-weight: 800; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: linear-gradient(180deg, #FFC24A, #F28C0F 50%, #C85A00); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent; filter: drop-shadow(0 0 6px rgba(242, 140, 15, .35)); }
.k-debut { display: inline-block; margin-left: 14px; font-size: .95rem; font-weight: 500; color: #CFE9C0; opacity: .85;
  -webkit-text-fill-color: #CFE9C0; background: none; vertical-align: middle; }
.k-pelote { display: inline-flex; flex: none; filter: drop-shadow(0 0 6px rgba(255, 182, 39, .45)); }

button { font: inherit; }
.k-btn { font-weight: 650; padding: 9px 16px; border-radius: 999px; border: 1px solid rgba(198, 243, 110, .45); cursor: pointer;
  color: var(--texte); background: rgba(198, 243, 110, .12); min-height: 40px; }
.k-btn:hover { background: rgba(198, 243, 110, .25); }
.k-btn.k-plein { color: #0B3B26; background: linear-gradient(135deg, #F4FFB0, #5FD86B); border-color: transparent; }
.k-btn.k-sapin { background: var(--sapin-bouton); } .k-btn.k-sapin:hover { background: var(--sapin-bouton-survol); }
.k-btn.k-danger { border-color: rgba(255, 138, 138, .5); background: rgba(255, 138, 138, .12); }
:focus-visible { outline: 3px solid #FFC24A; outline-offset: 2px; }

.k-milieu { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1fr); gap: 26px; align-items: start; min-height: 0; }
.k-col { min-width: 0; }
.k-carte { background: var(--carte); border: 1px solid var(--bord); border-radius: 18px; padding: 14px 18px; }
.k-titre { font-size: .85rem; letter-spacing: .08em; text-transform: uppercase; opacity: .7; margin-bottom: 8px; }

/* Centre : le compte */
.k-centre { text-align: center; display: grid; gap: 8px; justify-items: center; align-self: center; padding-bottom: 40px; }
.k-grand { font-size: min(36vh, 30vw); font-weight: 850; line-height: 1; font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #F4FFB0, #5FD86B 70%, #1E9E62); -webkit-background-clip: text; background-clip: text; color: transparent;
  transition: transform .12s; }
.k-grand.pop { transform: scale(1.07); }
.k-rang-n { font-size: 1.1rem; opacity: .85; }
.k-ecart { color: #FF8A8A; font-weight: 700; }
.k-entendu { min-height: 1.4em; color: var(--vert-clair); font-size: 1.05rem; }

/* Pause d'écoute : quelqu'un parle, le compte attend. */
.k-pause { font-size: 1.3rem; font-weight: 700; padding: 11px 22px; border-radius: 999px; cursor: pointer; margin-top: 56px;
  border: 2px solid rgba(198, 243, 110, .5); color: var(--texte); background: var(--sapin-bouton); }
.k-pause:hover { background: var(--sapin-bouton-survol); }
.k-pause.en-pause { border-color: transparent; color: #3A1D00; background: linear-gradient(120deg, #f5c400, #f07800); animation: k-clin 2s ease-in-out infinite; }
#compteur.k-en-pause .k-grand { opacity: .45; filter: grayscale(.6); }
@keyframes k-clin { 50% { transform: scale(1.04); } }
@media (prefers-reduced-motion: reduce) { .k-pause.en-pause { animation: none; } .k-grand { transition: none; } }

/* Petits boutons − et + orange sous « Pause » (comme dans Adèle, 04/12) */
.k-plusmoins { display: flex; justify-content: center; gap: 18px; margin-top: 34px; }
.k-pm { width: 46px; height: 46px; border-radius: 50%; border: none; cursor: pointer; font-size: 1.6rem; font-weight: 800; line-height: 1;
  color: #3A1D00; background: linear-gradient(180deg, #FFC24A, #F28C0F 55%, #C85A00); box-shadow: 0 2px 8px rgba(0, 0, 0, .35); }
.k-pm:hover { filter: brightness(1.1); }
.k-pm:active { transform: scale(.94); }

/* Voix */
.k-voix { display: grid; gap: 6px; justify-items: center; margin-top: 18px; max-width: 34ch; }
.k-voix-etat { font-size: .92rem; opacity: .85; }
.k-voix-etat.erreur { color: #FF9B9B; opacity: 1; }
.k-barre { width: min(100%, 280px); height: 8px; border-radius: 6px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.k-barre div { height: 100%; width: 0; background: linear-gradient(90deg, #C6F36E, #1E9E62); transition: width .2s; }
.k-micro { display: inline-block; width: .7em; height: .7em; border-radius: 50%; background: #5FD86B; margin-right: 6px; box-shadow: 0 0 8px #5FD86B; }
#compteur.k-en-pause .k-micro { background: #f5c400; box-shadow: 0 0 8px #f5c400; }

/* Tableaux de rangs, listes */
.k-rangs { width: 100%; border-collapse: collapse; font-size: .98rem; }
.k-rangs th { text-align: left; font-weight: 600; opacity: .65; padding: 4px 6px; border-bottom: 1px solid var(--bord); }
.k-rangs td { padding: 7px 6px; border-bottom: 1px solid rgba(255, 255, 255, .07); vertical-align: top; }
.k-liste { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.k-liste button { width: 100%; text-align: left; }
.k-bas { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.k-vide { text-align: center; padding: 30px 10px; font-size: 1.2rem; display: grid; gap: 14px; justify-items: center; }
.k-vide p { opacity: .85; }
.k-nouvel { margin-top: 12px; }
.k-termine { margin-bottom: 14px; text-align: right; }

/* Menu ☰ */
.k-droite { position: relative; display: flex; align-items: center; gap: 5px; flex: none; }
.k-burger { font-size: 1.15rem; line-height: 1; width: 42px; height: 42px; border-radius: 50%; cursor: pointer;
  border: 1px solid rgba(198, 243, 110, .45); color: var(--texte); background: rgba(198, 243, 110, .12); }
.k-burger:hover, .k-burger[aria-expanded="true"] { background: rgba(198, 243, 110, .3); }
.k-menu { display: none; position: absolute; top: calc(100% + 6px); right: 0; z-index: 5; width: min(440px, calc(100vw - 32px));
  max-height: min(75vh, 720px); overflow-y: auto; overscroll-behavior: contain;
  padding: 14px 18px; border-radius: 16px; border: 1px solid rgba(198, 243, 110, .35);
  background: var(--fond-menu); box-shadow: 0 14px 40px -12px rgba(0, 0, 0, .7); line-height: 1.4; }
.k-menu.ouvert { display: block; }
.k-menu section + section { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--bord); }
.k-menu p, .k-menu li { margin: 5px 0; }
.k-menu ol, .k-menu ul { padding-left: 20px; }
.k-menu b { color: #FFC24A; font-weight: 650; }
.k-fiche-ligne { margin: 5px 0; line-height: 1.35; }
.k-fiche-ligne b { color: #FFC24A; font-weight: 650; }
.k-fiche-avant { font-size: .85rem; opacity: .7; margin-top: 2px; }

/* Fenêtres (dialog) : fiche, nouvel ouvrage, modifier le rang, confirmation */
dialog { margin: auto; color: var(--texte); background: #0E3524; border: 1px solid rgba(233, 200, 110, .3); border-radius: 18px;
  padding: 18px 20px; width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); box-shadow: 0 12px 40px rgba(0, 0, 0, .5); }
dialog:modal { overscroll-behavior: contain; }
dialog::backdrop { background: rgba(4, 20, 13, .72); overflow: hidden; overscroll-behavior: contain; }
dialog h1 { font-size: 1.3rem; margin-bottom: 12px; color: #FFC24A; }
dialog h2 { font-size: .85rem; letter-spacing: .08em; text-transform: uppercase; opacity: .7; margin: 16px 0 8px; font-weight: 600; }
dialog label { display: grid; gap: 4px; margin: 10px 0; font-weight: 600; }
dialog label small { font-weight: 400; opacity: .7; }
dialog input, dialog textarea { font: inherit; color: var(--texte); background: #062A1C; border: 1px solid #C99A2E; border-radius: 10px; padding: 9px 11px; width: 100%; }
dialog textarea { min-height: 70px; resize: vertical; }
dialog .k-bas { margin-top: 16px; }
.k-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 8px; }
.k-photos figure { position: relative; }
.k-photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; display: block; cursor: zoom-in; }
.k-photos figcaption { font-size: .78rem; opacity: .75; margin-top: 2px; }
.k-photos .k-suppr { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(0, 0, 0, .6); color: #fff; }
.k-grande-photo { width: 100%; height: auto; border-radius: 12px; display: block; }
.k-notes { list-style: none; padding: 0; display: grid; gap: 6px; }
.k-notes li { background: rgba(255, 255, 255, .05); border-radius: 10px; padding: 7px 10px; }
.k-notes b { color: #CFE9C0; }

/* Pied de page */
.cadeau { text-align: center; padding: 10px 16px calc(14px + env(safe-area-inset-bottom)); font-size: .92rem; opacity: .9; }
.cadeau a { color: #FFC24A; }
.cadeau small { font-size: .74rem; opacity: .7; }

/* Fenêtre étroite (téléphone) : « Nouvel ouvrage » à gauche et « Terminé » à droite sur une ligne, le compte dessous */
@media (max-width: 1000px) {
  #compteur { padding: 16px; }
  .k-milieu { grid-template-columns: 1fr 1fr; align-content: start; gap: 12px; }
  .k-centre { order: 1; grid-column: 1 / -1; }
  .k-nouvel { margin-top: 0; }
}
@media (max-width: 700px) {
  #compteur { padding: 12px 14px; gap: 10px; }
  .k-haut { gap: 8px; }
  .k-haut h1 { font-size: 1.35rem; }
  .k-debut { display: block; margin-left: 0; font-size: .78rem; }
  .k-grand { font-size: min(34vh, 50vw); }
  .k-carte { padding: 10px 12px; }
  .k-rangs { font-size: .86rem; }
  .k-btn { padding: 7px 12px; font-size: .9rem; }
  .k-bas { gap: 6px; }
  .k-pause { margin-top: 24px; }
  .k-centre { padding-bottom: 10px; }
}

/* ---- Décor de Noël (jusqu'au 6 janvier 2027) : le même que les fenêtres d'Adèle ---- */
html.noel {
  --noel-boules: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22260%22 height=%22260%22 viewBox=%220 0 260 260%22%3E%3Cdefs%3E%3CradialGradient id=%22r%22 cx=%22.35%22 cy=%22.3%22 r=%22.75%22%3E%3Cstop offset=%220%22 stop-color=%22%23FF6A5C%22/%3E%3Cstop offset=%22.55%22 stop-color=%22%23D7192A%22/%3E%3Cstop offset=%221%22 stop-color=%22%237E0A16%22/%3E%3C/radialGradient%3E%3CradialGradient id=%22o%22 cx=%22.35%22 cy=%22.3%22 r=%22.75%22%3E%3Cstop offset=%220%22 stop-color=%22%23FFF0A8%22/%3E%3Cstop offset=%22.5%22 stop-color=%22%23E8B530%22/%3E%3Cstop offset=%221%22 stop-color=%22%238A6410%22/%3E%3C/radialGradient%3E%3C/defs%3E%3Cg opacity=%22.9%22%3E%3Cline x1=%2230%22 y1=%2222.3%22 x2=%2230%22 y2=%2230.3%22 stroke=%22%23E9D9A6%22 stroke-width=%22.8%22 opacity=%22.55%22/%3E%3Crect x=%2227.0%22 y=%2228.3%22 width=%226.1%22 height=%223.4%22 rx=%22.8%22 fill=%22%23C9A646%22/%3E%3Ccircle cx=%2230%22 cy=%2240%22 r=%228.7%22 fill=%22url%28%23r%29%22/%3E%3Cellipse cx=%2227.0%22 cy=%2236.5%22 rx=%222.4%22 ry=%221.6%22 fill=%22%23fff%22 opacity=%22.55%22/%3E%3Cline x1=%22120%22 y1=%225.800000000000001%22 x2=%22120%22 y2=%2213.8%22 stroke=%22%23E9D9A6%22 stroke-width=%22.8%22 opacity=%22.55%22/%3E%3Crect x=%22117.5%22 y=%2211.8%22 width=%225.0%22 height=%223.4%22 rx=%22.8%22 fill=%22%23C9A646%22/%3E%3Ccircle cx=%22120%22 cy=%2222%22 r=%227.2%22 fill=%22url%28%23o%29%22/%3E%3Cellipse cx=%22117.5%22 cy=%2219.1%22 rx=%222.0%22 ry=%221.3%22 fill=%22%23fff%22 opacity=%22.55%22/%3E%3Cline x1=%22205%22 y1=%2235.8%22 x2=%22205%22 y2=%2243.8%22 stroke=%22%23E9D9A6%22 stroke-width=%22.8%22 opacity=%22.55%22/%3E%3Crect x=%22201.4%22 y=%2241.8%22 width=%227.1%22 height=%223.4%22 rx=%22.8%22 fill=%22%23C9A646%22/%3E%3Ccircle cx=%22205%22 cy=%2255%22 r=%2210.2%22 fill=%22url%28%23r%29%22/%3E%3Cellipse cx=%22201.4%22 cy=%2250.9%22 rx=%222.9%22 ry=%221.8%22 fill=%22%23fff%22 opacity=%22.55%22/%3E%3Cline x1=%2270%22 y1=%22103.8%22 x2=%2270%22 y2=%22111.8%22 stroke=%22%23E9D9A6%22 stroke-width=%22.8%22 opacity=%22.55%22/%3E%3Crect x=%2267.5%22 y=%22109.8%22 width=%225.0%22 height=%223.4%22 rx=%22.8%22 fill=%22%23C9A646%22/%3E%3Ccircle cx=%2270%22 cy=%22120%22 r=%227.2%22 fill=%22url%28%23o%29%22/%3E%3Cellipse cx=%2267.5%22 cy=%22117.1%22 rx=%222.0%22 ry=%221.3%22 fill=%22%23fff%22 opacity=%22.55%22/%3E%3Cline x1=%22165%22 y1=%2292.3%22 x2=%22165%22 y2=%22100.3%22 stroke=%22%23E9D9A6%22 stroke-width=%22.8%22 opacity=%22.55%22/%3E%3Crect x=%22162.0%22 y=%2298.3%22 width=%226.1%22 height=%223.4%22 rx=%22.8%22 fill=%22%23C9A646%22/%3E%3Ccircle cx=%22165%22 cy=%22110%22 r=%228.7%22 fill=%22url%28%23r%29%22/%3E%3Cellipse cx=%22162.0%22 cy=%22106.5%22 rx=%222.4%22 ry=%221.6%22 fill=%22%23fff%22 opacity=%22.55%22/%3E%3Cline x1=%22240%22 y1=%22133.8%22 x2=%22240%22 y2=%22141.8%22 stroke=%22%23E9D9A6%22 stroke-width=%22.8%22 opacity=%22.55%22/%3E%3Crect x=%22237.5%22 y=%22139.8%22 width=%225.0%22 height=%223.4%22 rx=%22.8%22 fill=%22%23C9A646%22/%3E%3Ccircle cx=%22240%22 cy=%22150%22 r=%227.2%22 fill=%22url%28%23o%29%22/%3E%3Cellipse cx=%22237.5%22 cy=%22147.1%22 rx=%222.0%22 ry=%221.3%22 fill=%22%23fff%22 opacity=%22.55%22/%3E%3Cline x1=%2225%22 y1=%22170.8%22 x2=%2225%22 y2=%22178.8%22 stroke=%22%23E9D9A6%22 stroke-width=%22.8%22 opacity=%22.55%22/%3E%3Crect x=%2221.4%22 y=%22176.8%22 width=%227.1%22 height=%223.4%22 rx=%22.8%22 fill=%22%23C9A646%22/%3E%3Ccircle cx=%2225%22 cy=%22190%22 r=%2210.2%22 fill=%22url%28%23o%29%22/%3E%3Cellipse cx=%2221.4%22 cy=%22185.9%22 rx=%222.9%22 ry=%221.8%22 fill=%22%23fff%22 opacity=%22.55%22/%3E%3Cline x1=%22110%22 y1=%22182.3%22 x2=%22110%22 y2=%22190.3%22 stroke=%22%23E9D9A6%22 stroke-width=%22.8%22 opacity=%22.55%22/%3E%3Crect x=%22107.0%22 y=%22188.3%22 width=%226.1%22 height=%223.4%22 rx=%22.8%22 fill=%22%23C9A646%22/%3E%3Ccircle cx=%22110%22 cy=%22200%22 r=%228.7%22 fill=%22url%28%23r%29%22/%3E%3Cellipse cx=%22107.0%22 cy=%22196.5%22 rx=%222.4%22 ry=%221.6%22 fill=%22%23fff%22 opacity=%22.55%22/%3E%3Cline x1=%22195%22 y1=%22208.8%22 x2=%22195%22 y2=%22216.8%22 stroke=%22%23E9D9A6%22 stroke-width=%22.8%22 opacity=%22.55%22/%3E%3Crect x=%22192.5%22 y=%22214.8%22 width=%225.0%22 height=%223.4%22 rx=%22.8%22 fill=%22%23C9A646%22/%3E%3Ccircle cx=%22195%22 cy=%22225%22 r=%227.2%22 fill=%22url%28%23o%29%22/%3E%3Cellipse cx=%22192.5%22 cy=%22222.1%22 rx=%222.0%22 ry=%221.3%22 fill=%22%23fff%22 opacity=%22.55%22/%3E%3Cline x1=%22140%22 y1=%22145.2%22 x2=%22140%22 y2=%22153.2%22 stroke=%22%23E9D9A6%22 stroke-width=%22.8%22 opacity=%22.55%22/%3E%3Crect x=%22138.0%22 y=%22151.2%22 width=%224.1%22 height=%223.4%22 rx=%22.8%22 fill=%22%23C9A646%22/%3E%3Ccircle cx=%22140%22 cy=%22160%22 r=%225.8%22 fill=%22url%28%23r%29%22/%3E%3Cellipse cx=%22138.0%22 cy=%22157.7%22 rx=%221.6%22 ry=%221.0%22 fill=%22%23fff%22 opacity=%22.55%22/%3E%3Cline x1=%2260%22 y1=%22235.2%22 x2=%2260%22 y2=%22243.2%22 stroke=%22%23E9D9A6%22 stroke-width=%22.8%22 opacity=%22.55%22/%3E%3Crect x=%2258.0%22 y=%22241.2%22 width=%224.1%22 height=%223.4%22 rx=%22.8%22 fill=%22%23C9A646%22/%3E%3Ccircle cx=%2260%22 cy=%22250%22 r=%225.8%22 fill=%22url%28%23r%29%22/%3E%3Cellipse cx=%2258.0%22 cy=%22247.7%22 rx=%221.6%22 ry=%221.0%22 fill=%22%23fff%22 opacity=%22.55%22/%3E%3C/g%3E%3C/svg%3E");
  --noel-carte: rgba(8, 46, 31, .97);
  --noel-bord: rgba(233, 200, 110, .3);
  background: #0E3B2A;
}
html.noel body { background: var(--noel-boules) 0 0 / 260px 260px, radial-gradient(ellipse at 85% 8%, rgba(255, 220, 140, .14), transparent 42%) fixed,
  linear-gradient(180deg, #0E3B2A 0%, #0B4D33 45%, #13623F 75%, #1B7A4C 100%) fixed; }
html.noel .k-carte, html.noel .cadeau { background: var(--noel-carte); border-color: var(--noel-bord); }
html.noel .k-haut { background: var(--noel-carte); border-radius: 16px; padding: 6px 12px; }
html.noel .cadeau { border-top: 1px solid var(--noel-bord); }
html.noel .k-voix, html.noel .k-entendu:not(:empty) { background: var(--noel-carte); border-radius: 14px; padding: 6px 12px; }

/* Téléphone : « Nouvel ouvrage » et « Terminé » sur une ligne, le compte, puis les derniers rangs sur toute la largeur */
@media (max-width: 700px) {
  .k-milieu .k-col { display: contents; }
  .k-milieu .k-nouvel { grid-column: 1; order: 1; align-self: center; }
  .k-milieu .k-termine { grid-column: 2; order: 1; margin: 0; align-self: center; }
  .k-milieu .k-centre { order: 2; }
  .k-milieu .k-carte-rangs { grid-column: 1 / -1; order: 3; }
  .k-milieu .k-autres { grid-column: 1 / -1; order: 4; }
}
.k-defile { overflow-x: auto; max-width: 100%; }
