/* Fenêtres en relief : dimensions et commandes conservées. */
html body :is(dialog:not(.acces-jeu-dialog):not(.zor-perdu-dialog):not(.carte-jeu-fenetre),.fin-carte,.ed-fenetre,.zoomed-text,.card) {
  border:5px ridge #ffe6a5;
  border-radius:24px;
  background:linear-gradient(150deg,#52b9da 0%,#237eac 22%,#195b94 65%,#34356f 100%);
  box-shadow:inset 0 3px 2px #ffffffb0,inset 0 0 0 2px #19476f,inset 0 -8px 12px #071d4e80,0 6px 0 #a57432,0 10px 0 #5c3c1d,0 18px 30px #00162799;
  color:#fffbe8;
}
html body .ed-fenetre,
html body .publicite-zoom {
  border:5px ridge #ffd88a;
  border-radius:24px;
  background:linear-gradient(150deg,#ffffff 0%,#f4faff 28%,#d8eaf6 70%,#b9d8e9 100%);
  box-shadow:inset 0 3px 2px #ffffff,inset 0 -7px 10px #5187a044,0 6px 0 #ad803e,0 10px 0 #71512c,0 18px 30px #00162788;
  color:#17394d;
}
html body dialog::backdrop { background:transparent !important;backdrop-filter:none !important;-webkit-backdrop-filter:none !important; }
html body .zor-perdu-dialog { filter:drop-shadow(0 8px 8px #00182a88); }
html body :is(dialog:not(.acces-jeu-dialog):not(.carte-jeu-fenetre),.ed-fenetre,.publicite-zoom,.fin-carte) button {
  box-shadow:inset 0 2px 2px #ffffff88,inset 0 -3px 4px #001b4444,0 4px 0 #164463,0 7px 8px #001b4444;
}
html body :is(dialog:not(.acces-jeu-dialog):not(.carte-jeu-fenetre),.ed-fenetre,.publicite-zoom,.fin-carte) button:active {
  translate:0 3px;
  box-shadow:inset 0 2px 4px #001b4444,0 1px 0 #164463;
}
html body .teleportation-bulle {
  background:linear-gradient(150deg,#303030,#111111 55%,#000000);
  color:#ffffff;
  text-shadow:0 2px 2px #000000;
  box-shadow:inset 0 4px 5px #ffffffb0,inset 0 -5px 7px #00000077;
  filter:drop-shadow(0 4px 0 #000000) drop-shadow(0 7px 5px #00000088);
}

/* Contour noir suivant toutes les pointes de la bulle. */
html body .teleportation-bulle {
  isolation:isolate;
  background:#000000;
}
html body .teleportation-bulle::before {
  content:"";
  position:absolute;
  inset:3px;
  z-index:-1;
  pointer-events:none;
  clip-path:polygon(0 22%,23% 26%,20% 4%,45% 16%,68% 0,72% 26%,96% 20%,87% 45%,100% 65%,82% 80%,90% 100%,65% 84%,40% 100%,35% 78%,10% 100%,15% 72%,0 65%,12% 43%);
  background:linear-gradient(150deg,#303030,#111111 55%,#000000);
}

/* La consultation garde la couleur du joueur qui appelle Ed. */
html body .ed-fenetre[data-couleur="bleu"] {
  border-color:#66b8ff; background:linear-gradient(150deg,#389aff,#176bd1 55%,#104489); color:#ffffff;
}
html body .ed-fenetre[data-couleur="rouge"] {
  border-color:#ff8b88; background:linear-gradient(150deg,#f65a59,#c62332 55%,#861525); color:#ffffff;
}
html body .ed-fenetre[data-couleur="jaune"] {
  border-color:#fff08a; background:linear-gradient(150deg,#fff47a,#ffe022 55%,#eeb900); color:#302600;
}
html body .ed-fenetre[data-couleur="vert"] {
  border-color:#80dd99; background:linear-gradient(150deg,#35ae65,#178342 55%,#0c522d); color:#ffffff;
}
html body .ed-fenetre[data-couleur] #ed-reponse { color:#17394d; }
html body .ed-fenetre[data-couleur="rouge"] button { background:#a71c2a; border-color:#ffaaa8; }
html body .ed-fenetre[data-couleur="jaune"] button { background:#ffe650; color:#302600; border-color:#b78c00; }
html body .ed-fenetre[data-couleur="vert"] button { background:#106434; border-color:#8cdfa5; }

html body dialog:not(.acces-jeu-dialog):not(.carte-jeu-fenetre)[data-couleur="bleu"] { border-color:#66b8ff !important; background:linear-gradient(150deg,#389aff,#176bd1 55%,#104489) !important; color:#fff !important; }
html body dialog:not(.acces-jeu-dialog):not(.carte-jeu-fenetre)[data-couleur="bleu"] button { background:#66b8ff; color:#17394d; border:2px solid #66b8ff; }

html body dialog:not(.acces-jeu-dialog):not(.carte-jeu-fenetre)[data-couleur="rouge"] { border-color:#ff8b88 !important; background:linear-gradient(150deg,#f65a59,#c62332 55%,#861525) !important; color:#fff !important; }
html body dialog:not(.acces-jeu-dialog):not(.carte-jeu-fenetre)[data-couleur="rouge"] button { background:#ff8b88; color:#17394d; border:2px solid #ff8b88; }

html body dialog:not(.acces-jeu-dialog):not(.carte-jeu-fenetre)[data-couleur="jaune"] { border-color:#fff08a !important; background:linear-gradient(150deg,#fff47a,#ffe022 55%,#eeb900) !important; color:#302600 !important; }
html body dialog:not(.acces-jeu-dialog):not(.carte-jeu-fenetre)[data-couleur="jaune"] button { background:#fff08a; color:#17394d; border:2px solid #fff08a; }

html body dialog:not(.acces-jeu-dialog):not(.carte-jeu-fenetre)[data-couleur="vert"] { border-color:#80dd99 !important; background:linear-gradient(150deg,#35ae65,#178342 55%,#0c522d) !important; color:#fff !important; }
html body dialog:not(.acces-jeu-dialog):not(.carte-jeu-fenetre)[data-couleur="vert"] button { background:#80dd99; color:#17394d; border:2px solid #80dd99; }


/* Fenêtres fixes sur la pelouse, sans déplacement vers le ciel. */
html body :is(dialog:not(.acces-jeu-dialog):not(.zor-perdu-dialog):not(.carte-jeu-fenetre),.fin-carte,.zoomed-text) {
  position:fixed !important;
  inset:26% auto auto 48% !important;
  margin:0 !important;
  box-sizing:border-box;
  width:33vw !important;
  height:24dvh !important;
  min-width:0 !important;
  min-height:0 !important;
  max-width:none !important;
  max-height:none !important;
  padding:clamp(6px,1vw,16px) !important;
  animation:none !important;
  transform:none !important;
  overflow:hidden !important;
  font-size:clamp(12px,1.35vw,22px) !important;
  line-height:1.2 !important;
  text-align:center;
}
.fenetre-contenu-adapte {
  display:flex; flex-wrap:wrap; align-items:center; justify-content:center;
  align-content:center; gap:clamp(4px,.6vw,10px);
  box-sizing:border-box; min-height:100%; transform-origin:top left;
}
html body .fenetre-contenu-adapte :is(p,h1,h2,h3) {
  flex:0 0 100%; margin:0 !important; font-size:1.1em !important;
  line-height:1.2; overflow-wrap:anywhere;
}
html body .fenetre-contenu-adapte label {
  display:flex; align-items:center; justify-content:center;
  margin:0 !important; padding:4px !important; gap:6px !important;
  min-width:0; font-size:inherit !important;
}
html body .fenetre-contenu-adapte label span { min-width:0; overflow-wrap:anywhere; }
html body .fenetre-contenu-adapte :is(button,select,input,textarea) {
  box-sizing:border-box; font:inherit !important; margin:0 !important;
  padding:clamp(4px,.5vw,8px) !important; max-width:100%; min-width:0;
}
html body .fenetre-contenu-adapte input[type=checkbox] {
  flex:0 0 1em; width:1em; height:1em; padding:0 !important;
}
html body .fenetre-contenu-adapte img { max-width:100%; max-height:16dvh; object-fit:contain; }
html body .fenetre-contenu-adapte iframe { width:100%; max-height:16dvh; }

/* La pelouse remplace le cadre : sa teinte suit son contour intérieur. */
body {
 --pelouse-forme:polygon(36.182% 25.360%,41.364% 25.216%,47.727% 25.793%,56.364% 26.081%,64.545% 26.513%,71.636% 27.810%,76.909% 29.971%,79.909% 32.853%,81.455% 35.447%,81.727% 37.752%,80.727% 40.202%,79.364% 42.075%,77.182% 44.236%,74.636% 46.110%,71.636% 48.127%,68.455% 49.568%,64.182% 50.865%,60.273% 51.441%,58.909% 48.559%,55.091% 49.280%,52.364% 50.288%,50.727% 48.991%,52.000% 47.262%,53.455% 44.236%,54.545% 41.787%,52.727% 38.617%,50.091% 35.735%,47.545% 32.565%,44.182% 29.827%,40.727% 27.233%);
}
html body :is(dialog:not(.acces-jeu-dialog):not(.zor-perdu-dialog):not(.carte-jeu-fenetre),.fin-carte,.zoomed-text) {
 border:0 !important; border-radius:0 !important;
 background:transparent !important; box-shadow:none !important; filter:none !important;
 color:#fff !important; text-shadow:0 2px 3px #000;
 inset:29% auto auto 53% !important; width:24vw !important; height:19dvh !important;
 padding:5px !important; z-index:10000;
}
html body dialog:not(.acces-jeu-dialog):not(.carte-jeu-fenetre)::backdrop,
.pelouse-fenetre-teinte {
 background:var(--pelouse-teinte,rgba(8,38,91,.5)) !important;
 clip-path:var(--pelouse-forme); backdrop-filter:none !important;
}
.pelouse-fenetre-teinte { position:fixed; inset:0; z-index:9999; pointer-events:none; }
.pelouse-fenetre-teinte[hidden] { display:none; }
html body dialog:not(.acces-jeu-dialog):not(.carte-jeu-fenetre)[data-couleur="bleu"] { --pelouse-teinte:rgba(6,37,105,.5); }
html body dialog:not(.acces-jeu-dialog):not(.carte-jeu-fenetre)[data-couleur="rouge"] { --pelouse-teinte:rgba(108,9,22,.5); }
html body dialog:not(.acces-jeu-dialog):not(.carte-jeu-fenetre)[data-couleur="jaune"] { --pelouse-teinte:rgba(108,85,0,.5); }
html body dialog:not(.acces-jeu-dialog):not(.carte-jeu-fenetre)[data-couleur="vert"] { --pelouse-teinte:rgba(4,66,29,.5); }
html body .fenetre-contenu-adapte :is(button,select,input,textarea) { text-shadow:none; }
html body .fenetre-contenu-adapte label { color:inherit; }

/* Choix courts et grandes commandes sur la pelouse. */
html body .fenetre-contenu-adapte { gap:clamp(6px,.75vw,12px); }
html body .fenetre-contenu-adapte :is(p,h1,h2,h3) {
 font-size:clamp(16px,1.5vw,25px) !important; line-height:1.15;
}
html body .fenetre-contenu-adapte button {
 font-size:clamp(16px,1.4vw,24px) !important;
 font-weight:900 !important;
 min-height:44px; padding:10px 14px !important;
 flex:1 1 42%; border-radius:12px;
}
html body .fenetre-contenu-adapte :is(select,label) {
 font-size:clamp(16px,1.4vw,24px) !important;
 min-height:40px; padding:7px !important;
}
html body .fenetre-contenu-adapte input[type=checkbox] {
 flex-basis:24px; width:24px; height:24px;
}

/* Dérouleurs du jeu : parchemin en relief et grande flèche dorée. */
html body .fenetre-contenu-adapte select {
  appearance:none !important;
  -webkit-appearance:none !important;
  display:block;
  flex:1 1 100%;
  width:100%;
  min-height:46px;
  padding:10px 46px 10px 14px !important;
  border:3px solid #b77a27 !important;
  border-radius:14px !important;
  background-color:#fff1c6 !important;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Crect x='1' y='1' width='30' height='30' rx='9' fill='%23eeb64c' stroke='%23935b19' stroke-width='2'/%3E%3Cpath d='M9 12l7 8 7-8' fill='none' stroke='%23523817' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"),linear-gradient(180deg,#fffbed,#ffe8aa) !important;
  background-repeat:no-repeat !important;
  background-position:right 8px center,center !important;
  background-size:30px 30px,100% 100% !important;
  color:#423014 !important;
  font-size:clamp(16px,1.4vw,24px) !important;
  font-weight:800 !important;
  line-height:1.2 !important;
  text-align:left;
  text-overflow:ellipsis;
  box-shadow:inset 0 2px 2px #fff,inset 0 -3px 5px #c28d3844,0 4px 0 #754716,0 7px 10px #0005 !important;
  cursor:pointer;
}
html body .fenetre-contenu-adapte select:hover {
  border-color:#ffe295 !important;
  background-color:#fff8df !important;
}
html body .fenetre-contenu-adapte select:focus-visible {
  outline:3px solid #fff7c3;
  outline-offset:3px;
}
html body .fenetre-contenu-adapte select option {
  background:#fff2cc;
  color:#423014;
  font-weight:700;
}
html body .fenetre-contenu-adapte select option:checked {
  background:#e7b34c;
  color:#302009;
}

/* Les choix laissent désormais la pelouse sans filtre coloré. */
html body dialog:not(.acces-jeu-dialog):not(.carte-jeu-fenetre)::backdrop { background:transparent !important; }
html body .pelouse-fenetre-teinte { display:none !important; }

/* Ed : consultation à sa gauche, au milieu de l’écran. */
html body #ed-fenetre {
  position:fixed !important;
  inset:50% 44% auto auto !important;
  transform:translateY(-50%) !important;
  width:40vw !important;
  height:auto !important;
  max-height:86dvh !important;
  box-sizing:border-box;
  overflow:auto !important;
  margin:0 !important;
  padding:clamp(12px,1.4vw,24px) !important;
  z-index:10000;
}
html body #ed-fenetre :is(input,select) { box-sizing:border-box; }
@media(max-width:650px) {
  html body #ed-fenetre { width:54vw !important; right:43% !important; }
}

/* Quitter : fenêtre centrale indépendante des fenêtres de choix du plateau. */
html body dialog#confirm-exit {
 position:fixed !important;inset:50% auto auto 50% !important;
 transform:translate(-50%,-50%) !important;margin:0 !important;
 width:min(440px,90vw) !important;height:auto !important;
 max-height:90dvh !important;min-height:0 !important;max-width:90vw !important;
 padding:clamp(18px,3vw,30px) !important;overflow:auto !important;
 border:6px ridge #ffe49b !important;border-radius:28px !important;
 background:linear-gradient(150deg,#58c7dc,#1765a4 55%,#34377d) !important;
 color:#fff !important;text-align:center;
 box-shadow:inset 0 4px 2px #ffffffb0,inset 0 -9px 12px #051c6080,0 8px 0 #a46a2d,0 13px 0 #4f346e,0 24px 36px #001a3bcc !important;
}
html body #confirm-exit :is(h1,h2){font-size:clamp(20px,3vw,28px) !important;line-height:1.2;margin:0 0 22px;}
html body #confirm-exit .choices {display:grid;grid-template-columns:1fr;gap:19px;padding:0 0 10px;}
html body #confirm-exit .choices button {
 width:100%;min-height:58px !important;padding:12px 16px !important;
 border:3px solid #ffe8ab !important;border-radius:18px !important;
 color:#fff !important;font:900 clamp(15px,2vw,19px)/1.25 "Trebuchet MS",sans-serif !important;
 text-shadow:0 2px 2px #00233d;cursor:pointer;
 box-shadow:inset 0 3px 1px #ffffffb0,inset 0 -4px 4px #00274270,0 6px 0 #754b24,0 10px 12px #001b4370 !important;
 transition:transform .15s,filter .15s;
}
html body #confirm-exit #cancel-exit{background:linear-gradient(#58dca8,#087e72) !important;}
html body #confirm-exit #leave-fullscreen{background:linear-gradient(#58cdec,#1265b0) !important;}
html body #confirm-exit #leave-game{background:linear-gradient(#ffb873,#c44835) !important;}
html body #confirm-exit button:hover{filter:brightness(1.12);transform:translateY(-2px);}
html body #confirm-exit button:active{transform:translateY(4px);box-shadow:inset 0 3px 4px #00274260,0 2px 0 #754b24 !important;}
html body #confirm-exit button:focus-visible{outline:3px solid white;outline-offset:4px;}
html body #confirm-exit .fenetre-contenu-adapte{display:block;transform:none !important;min-height:0 !important;}

/* Quitter : voile noir à 80 % sur tout l’écran. */
html body dialog#confirm-exit::backdrop {
 background:rgba(0,0,0,.8) !important;
 clip-path:none !important;
 backdrop-filter:none !important;
 -webkit-backdrop-filter:none !important;
}
