
@font-face{font-family:'FredokaCustom';src:url('fonts/FredokaOne-Regular.otf') format('opentype');font-display:swap;}
@font-face{font-family:'ScriptEcole';src:url('fonts/scriptcole.ttf') format('truetype');font-display:swap;}
@font-face{font-family:'CursiveDumont';src:url('fonts/CursiveDumontMaternelle.otf') format('opentype');font-display:swap;}
:root{
  --bg1:#edf6f0; --bg2:#fcf0e9; --panel:rgba(255,255,255,.96); --text:#33435b;
  --muted:#708097; --shadow:0 16px 40px rgba(64,94,78,.14); --shadow-soft:0 8px 20px rgba(64,94,78,.10);
  --pill:999px; --radius-xl:34px; --green:#d9eee3; --green-deep:#a3cdb8; --accent:#ffd36e;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  min-height:100vh;
  font-family:'FredokaCustom', Arial, sans-serif;
  color:var(--text);
  background:
    radial-gradient(circle at 10% 8%, rgba(255,255,255,.92), transparent 18%),
    radial-gradient(circle at 88% 10%, rgba(255,255,255,.82), transparent 20%),
    linear-gradient(180deg,var(--bg1),var(--bg2));
}
button,input{font:inherit}
a{text-decoration:none;color:inherit}
.mot{display:inline-block;white-space:nowrap;line-height:1}
.c-vert{color:#53a85a}.c-vert-sapin{color:#2f7d4c}.c-gris{color:#9fa5ad}
.c-rouge{color:#de6c63}.c-bleu{color:#5f7fe3}.c-noir{color:#2f3440}
.app{max-width:1220px;margin:0 auto;padding:12px;width:100%}
.header{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px;margin-bottom:10px}
.title-card{background:var(--panel);border-radius:20px;box-shadow:var(--shadow);padding:15px 20px;flex:1;min-width:300px}
.title-card h1{margin:0;font-size:clamp(20px,4vw,32px);line-height:1.1}
.header-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.scene-nav{display:flex;align-items:center;gap:5px;background:var(--panel);padding:5px;border-radius:20px;box-shadow:var(--shadow)}
.scene-link,.home-link,.arrow-link{padding:8px 12px;border-radius:15px;background:#fff;box-shadow:var(--shadow-soft);font-size:14px;line-height:1;white-space:nowrap}
.scene-link.active{background:var(--green);color:#3c6857}
.home-link{display:inline-flex;align-items:center;gap:8px}
.arrow-link{font-size:18px;display:inline-flex;align-items:center;justify-content:center;min-width:46px}
.arrow-link[aria-disabled="true"]{opacity:.45;pointer-events:none}
.gear{width:48px;height:48px;border:none;border-radius:15px;background:#fff;box-shadow:var(--shadow);font-size:24px;cursor:pointer}
.layout{display:flex;flex-direction:column;gap:15px}
.scene-card,.words-card{background:var(--panel);border-radius:20px;box-shadow:var(--shadow)}
.scene-card{padding:10px}
.scene{position:relative;width:100%;max-width:100%;aspect-ratio:3 / 2;border-radius:15px;overflow:hidden;background:#f5f1ea;touch-action:none}
.scene img{width:100%;height:100%;object-fit:cover;object-position:center;display:block;pointer-events:auto;cursor:pointer;user-select:none;-webkit-user-drag:none}
.dropzone{position:absolute;background:transparent;border:none;outline:none}
.debug-zones .dropzone{background:rgba(90,170,255,.18);outline:2px dashed rgba(35,100,190,.55);border-radius:18px;}
.dropzone.success{animation:zonePop .28s ease}
@keyframes zonePop{0%{transform:scale(1)}50%{transform:scale(1.04)}100%{transform:scale(1)}}
.placed-tag{position:absolute;transform:translate(-50%,-50%);min-width:160px;text-align:center;padding:14px 18px;border-radius:var(--pill);background:rgba(255,255,255,0.4) !important;backdrop-filter:blur(2px);border:2px solid rgba(228,236,222,0.6);box-shadow:var(--shadow-soft);font-size:clamp(28px,2vw,40px);line-height:1;z-index:8;pointer-events:auto;cursor:pointer;text-transform:none !important;}
.words-card{padding:16px}
.words-top{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:12px}
.words-title{margin:0;font-size:14px;text-transform:uppercase;letter-spacing:.08em;color:var(--muted)}
.words{display:flex;flex-wrap:wrap;justify-content:center;gap:14px;min-height:84px}
.word{position:relative;min-width:160px;text-align:center;padding:16px 20px;background:#fff;border:2px solid #e1eae4;border-radius:var(--pill);box-shadow:var(--shadow-soft);font-size:clamp(28px,2vw,40px);line-height:1;user-select:none;touch-action:none;cursor:grab;z-index:3;transition:transform .12s ease, box-shadow .12s ease, opacity .12s ease;text-transform:none !important;}
.word:hover{transform:translateY(-1px)}
.word.dragging{box-shadow:0 18px 28px rgba(0,0,0,.16);cursor:grabbing;z-index:40;background:rgba(255,255,255,.6) !important;backdrop-filter:blur(2px);}
.word.selected{box-shadow:0 0 0 4px rgba(169,212,190,.6), var(--shadow-soft)}
.word.placed{opacity:.36;pointer-events:auto;cursor:pointer;filter:saturate(.5)}
.bottom-actions{
  display:flex;justify-content:flex-end;align-items:center;gap:10px;
  margin-top:14px;padding-bottom:8px;
}
.reset-btn,.next-btn,.prev-btn{
  border:none;background:#fff;border-radius:18px;box-shadow:var(--shadow-soft);
  padding:12px 16px;cursor:pointer;color:var(--text);font-size:16px;
  display:inline-flex;align-items:center;gap:10px;line-height:1;min-height:48px;
}
.next-btn,.prev-btn{font-size:22px;padding:12px 15px}
.reset-btn:hover,.next-btn:hover,.prev-btn:hover{transform:translateY(-1px)}
.drawer{position:fixed;top:88px;right:18px;width:min(440px, calc(100vw - 24px));background:rgba(255,255,255,.99);border-radius:28px;box-shadow:var(--shadow);padding:18px;display:none;z-index:60}
.drawer.open{display:block}
.drawer h2{margin:0;font-size:24px}
.drawer .sub{margin:4px 0 12px 0;color:var(--muted);font-size:13px}
.setting{padding:12px 0;border-top:1px solid #eaf0f7}
.setting:first-of-type{border-top:none;padding-top:0}
.setting.row{display:flex;align-items:center;justify-content:space-between;gap:10px}
.setting .title{display:block;margin-bottom:10px;color:var(--muted);font-size:13px;text-transform:uppercase;letter-spacing:.08em}
.choice-grid{display:grid;gap:10px}
.choice{display:flex;align-items:center;gap:12px;padding:10px 12px;border-radius:18px;background:#f4f8fc}
.choice input{margin:0}
.choice span{display:flex;flex-direction:column;gap:2px}
.choice small{color:var(--muted)}
.preview.script{font-family:'ScriptEcole', cursive;font-size:30px;font-weight:400}
.preview.dumont{font-family:'CursiveDumont', cursive;font-size:32px;font-weight:400}
.preview.fredoka{font-family:'FredokaCustom', Arial, sans-serif;text-transform:uppercase}
.footer{margin-top:14px;padding-bottom:8px;text-align:center;color:var(--muted);font-size:13px}
.celebration{position:fixed;inset:0;pointer-events:auto;cursor:pointer;display:none;z-index:80}
.celebration.show{display:block}
.bravo-card{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);background:#fff;padding:40px;border-radius:40px;box-shadow:var(--shadow);text-align:center;min-width:320px}
.bravo-card h3{margin:0;font-size:36px}
.bravo-card p{margin:8px 0 0 0;font-size:18px;color:var(--text)}
.medal{font-size:54px;margin-bottom:8px}
.confetti{position:absolute;width:12px;height:18px;border-radius:4px;opacity:.9;animation:fall linear forwards}
@keyframes fall{from{transform:translateY(-40px) rotate(0deg);opacity:1}to{transform:translateY(100vh) rotate(540deg);opacity:.2}}
.script-connected .mot,.script-connected .word,.script-connected .placed-tag{letter-spacing:-0.01em}
.script-connected .mot{display:inline-block !important;white-space:nowrap}
.script-connected .mot span{display:inline !important;margin:0 !important;padding:0 !important;letter-spacing:inherit !important}
.script-ecole-mode .mot,.script-ecole-mode .word,.script-ecole-mode .placed-tag{font-family:'ScriptEcole', cursive !important}
.dumont-mode .mot,.dumont-mode .word,.dumont-mode .placed-tag{font-family:'CursiveDumont', cursive !important}
.script-ecole-mode .mot,.dumont-mode .mot,
.script-ecole-mode .word,.script-ecole-mode .placed-tag,
.dumont-mode .word,.dumont-mode .placed-tag{
  text-rendering:optimizeLegibility !important;
  font-kerning:normal !important;
  font-synthesis:none !important;
  font-variant-ligatures:common-ligatures contextual !important;
  font-feature-settings:"kern" 1,"liga" 1,"clig" 1,"calt" 1 !important;
  -webkit-font-smoothing:antialiased;
}
.script-ecole-mode .word,.script-ecole-mode .placed-tag,.dumont-mode .word,.dumont-mode .placed-tag{
  font-weight:400 !important;
  font-size:clamp(40px, 2.75vw, 56px) !important;
  line-height:1.08 !important;
}
.script-ecole-mode .word .mot > span, .dumont-mode .word .mot > span,
.script-ecole-mode .placed-tag .mot > span, .dumont-mode .placed-tag .mot > span {
  display:inline !important;
  margin:0 !important;
  padding:0 !important;
}

.home-shell{max-width:1220px;margin:0 auto;padding:22px 16px 34px}
.home-stack{display:grid;gap:22px}
.home-intro{background:linear-gradient(180deg, rgba(255,255,255,.98), rgba(255,255,255,.93));border-radius:38px;box-shadow:var(--shadow);padding:28px 30px;text-align:center;position:relative;overflow:hidden}
.home-intro::before,.home-intro::after{content:'';position:absolute;border-radius:50%;pointer-events:auto;cursor:pointer;opacity:.75}
.home-intro::before{width:180px;height:180px;left:-48px;top:-58px;background:radial-gradient(circle, rgba(184,220,196,.45), rgba(184,220,196,0));}
.home-intro::after{width:210px;height:210px;right:-72px;bottom:-92px;background:radial-gradient(circle, rgba(245,197,171,.4), rgba(245,197,171,0));}
.home-intro h2{position:relative;z-index:1;margin:18px auto 10px auto;font-size:clamp(26px,4.6vw,52px);line-height:1.1;color:#354264}
.home-intro p{position:relative;z-index:1;margin:0 auto;max-width:26ch;color:var(--muted);font-size:clamp(19px,2.2vw,28px);line-height:1.45}
.home-stage{background:linear-gradient(180deg, rgba(255,255,255,.98), rgba(255,255,255,.94));border-radius:38px;box-shadow:var(--shadow);padding:18px}
.home-poster{position:relative;overflow:hidden;border-radius:30px;background:#f0f7f1;aspect-ratio:3 / 2}
.home-poster img{width:100%;height:100%;object-fit:cover;object-position:center;display:block}
.poster-btn{display:none}
.poster-btn:hover,.poster-btn:focus-visible{transform:translateY(-2px) scale(1.01);background:rgba(255,255,255,.08)}
.poster-btn:focus-visible{box-shadow:0 0 0 5px rgba(255,255,255,.96), 0 0 0 11px rgba(72,118,220,.28)}
.poster-btn.play-btn{left:12.8%;top:79.1%;width:35.5%;height:14.8%}
.poster-btn.settings-btn{left:50.3%;top:79.1%;width:36.8%;height:14.8%}
.home-tip{margin:14px 6px 2px 6px;text-align:center;color:#677892;font-size:clamp(15px,1.8vw,20px)}
.home-tip strong{color:#39506e}

.home-actions{display:flex;flex-wrap:wrap;justify-content:center;gap:14px;margin-top:18px}
.home-btn{display:inline-flex;align-items:center;justify-content:center;gap:10px;padding:14px 20px;border-radius:999px;background:#ffffff;border:2px solid #e0ebe4;box-shadow:var(--shadow-soft);font-size:clamp(15px,2vw,20px);font-weight:700;color:#33435b;min-height:54px}
.home-btn.primary{background:linear-gradient(180deg,#ffe28a,#ffd36e);border-color:#f1c857}
.home-btn:hover{transform:translateY(-1px)}
.home-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}
.home-scene-card{background:rgba(255,255,255,.96);border-radius:26px;box-shadow:var(--shadow);overflow:hidden}
.home-scene-card img{display:block;width:100%;aspect-ratio:3/2;object-fit:cover}
.home-scene-card .content{padding:14px 16px 18px}
.home-scene-card h3{margin:0 0 8px 0;font-size:clamp(18px,2vw,24px)}
.home-scene-card p{margin:0 0 14px 0;color:var(--muted);font-size:14px;line-height:1.45;min-height:40px}
.home-scene-card a{display:inline-flex;align-items:center;justify-content:center;padding:11px 15px;border-radius:999px;background:#fff;border:2px solid #e0ebe4;box-shadow:var(--shadow-soft)}
@media (max-width: 860px){.home-grid{grid-template-columns:1fr}.home-actions{flex-direction:column}.home-btn{width:100%}}



body.play-mode .app{max-width:1400px;width:100%;min-height:100dvh;padding:8px 10px 10px}
body.play-mode .layout{gap:10px}
body.play-mode .scene-card{padding:8px}
body.play-mode .scene{aspect-ratio:3 / 2;height:auto;max-height:calc(100dvh - 240px);width:min(100%, calc((100dvh - 240px) * 1.5));margin:0 auto}
body.play-mode .words-card{padding-top:12px}

@media (max-width: 1040px){
  .header{align-items:flex-start;flex-direction:column}
  .header-actions{width:100%;justify-content:space-between}
  .scene-nav{flex-wrap:wrap}
}

@media (max-width: 920px){
  body.play-mode .app{padding:6px 8px 8px}
  body.play-mode .scene{aspect-ratio:3 / 2;height:auto;max-height:calc(100dvh - 220px);width:min(100%, calc((100dvh - 220px) * 1.5));margin:0 auto}

  .app{padding:10px}
  .title-card{padding:14px 16px;border-radius:22px}
  .scene-card,.words-card{border-radius:24px}
  .scene-card{padding:8px}
  .scene{border-radius:18px}
  .scene{aspect-ratio:3 / 2;height:auto;max-height:none}
  .placed-tag,.word{min-width:120px;padding:12px 14px;font-size:24px}
  .drawer{top:76px;right:10px}
  .script-ecole-mode .word,.script-ecole-mode .placed-tag,.dumont-mode .word,.dumont-mode .placed-tag{font-size:36px !important;line-height:1.02 !important}
  .script-ecole-mode .word,.dumont-mode .word{min-width:132px;padding:12px 16px}
  .script-ecole-mode .placed-tag,.dumont-mode .placed-tag{min-width:132px;padding:11px 16px}
  .scene-link{padding:11px 15px}
  .home-shell{padding:16px 12px 26px}
  .home-intro{padding:24px 20px}
  .home-stage{padding:14px}
}

@media (max-width: 820px){
  .layout{gap:12px}
  .scene-card{padding:6px}
  .scene{
    width:100%;
    aspect-ratio:3 / 2;
    height:auto;
    min-height:0;
    max-height:none;
  }
  .words-card{padding:12px 12px 10px}
  .words-top{margin-bottom:10px}
  .words{
    justify-content:flex-start;
    flex-wrap:nowrap;
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
    padding-bottom:6px;
    gap:10px;
  }
  .word{
    min-width:max-content;
    padding:12px 16px;
    font-size:clamp(22px,4.7vw,34px);
    flex:0 0 auto;
  }
  .placed-tag{
    min-width:114px;
    padding:10px 14px;
    font-size:clamp(20px,4.2vw,30px);
  }
  .bottom-actions{
    position:static;
    margin-top:10px;
    padding-bottom:4px;
  }
  .reset-btn,.next-btn,.prev-btn{
    min-height:46px;
    padding:12px 14px;
  }
}

@media (max-width: 640px){
  body.play-mode .app{padding:4px 4px 8px}
  body.play-mode .scene{aspect-ratio:3 / 2;height:auto;max-height:calc(100dvh - 190px);width:min(100%, calc((100dvh - 190px) * 1.5));margin:0 auto}

  .words-top{flex-direction:column;align-items:flex-start}
  .bravo-card{min-width:auto;width:min(92vw,420px);padding:28px}
  .home-shell{padding:14px 10px 24px}
  .home-intro{border-radius:28px;padding:20px 16px}
  .home-stage{border-radius:28px;padding:10px}
  .home-poster{border-radius:22px}
  .home-intro h2{max-width:18ch;margin-top:8px}
  .home-tip{font-size:15px;line-height:1.4}
  .poster-btn.play-btn{left:13.2%;top:78.8%;width:35.2%;height:15.2%}
  .poster-btn.settings-btn{left:50.1%;top:78.8%;width:36.9%;height:15.2%}
  .header-actions{gap:8px}
  .home-link,.scene-link,.arrow-link{padding:10px 12px}
  .scene{
    aspect-ratio:3 / 2;
    height:auto;
    min-height:0;
  }
  .words{gap:9px}
  .word{
    padding:11px 14px;
    font-size:clamp(20px,5vw,30px);
  }
  .placed-tag{
    min-width:106px;
    padding:9px 12px;
    font-size:clamp(18px,4.8vw,28px);
  }
  .bottom-actions{
    justify-content:space-between;
    gap:8px;
    flex-wrap:nowrap;
  }
  body.play-mode .scene-card{padding:4px}
  body.play-mode .scene{aspect-ratio:3 / 2;height:auto;max-height:none;width:100%;max-width:100%}
  .reset-btn{
    flex:1 1 auto;
    justify-content:center;
    font-size:15px;
  }
  .prev-btn,.next-btn{
    flex:0 0 auto;
    min-width:48px;
    justify-content:center;
  }
}

/* Même présentation que le jeu source, adaptée aux longues étiquettes. */
.home-intro p{max-width:42ch}
.home-title-kicker{display:block;font-size:clamp(14px,2vw,19px);letter-spacing:.05em;color:#577895;margin-bottom:12px}
.home-scene-card h3{font-size:clamp(18px,2vw,23px);line-height:1.25}
.home-scene-card .level{display:block;color:#5d7296;font-size:13px;margin-bottom:7px}
.home-scene-card img{cursor:pointer}
.play-tip{margin:0 2px 10px;color:var(--muted);font-size:13px;line-height:1.4}
.words-title{letter-spacing:.04em}
.progress{font-size:14px;color:#577895;white-space:nowrap}
.placed-tag{min-width:0;max-width:98%;font-size:clamp(17px,2.3vw,30px);padding:9px 13px}
.placed-tag .mot{max-width:100%}
.drawer{top:12px;max-height:calc(100dvh - 24px);overflow-y:auto}
.drawer-heading{display:flex;justify-content:space-between;align-items:center;gap:12px}
.drawer-close{width:38px;height:38px;flex-shrink:0;border:0;border-radius:50%;background:#eaf1f8;color:#49657e;font-size:20px;cursor:pointer}
.audio-info{display:block;font-size:11px;color:var(--muted);line-height:1.4;margin-top:6px}
.audio-status{font-size:12px;color:#7d552f;line-height:1.4;margin:0 0 10px}
.drawer .setting.row>label{max-width:85%}
.drawer input[type=checkbox],.drawer input[type=radio]{accent-color:#5c86a9;min-width:18px;min-height:18px}
.word:focus-visible,.placed-tag:focus-visible,button:focus-visible,a:focus-visible{outline:3px solid #3e7d9a;outline-offset:4px}
.word.selected{border-color:#6b9fc5;box-shadow:0 0 0 4px #d8eaf8, var(--shadow-soft)}
.bravo-card{max-width:90vw}
.bravo-card p{line-height:1.4}
.celebration{background:rgba(42,68,100,.12)}
.next-stage-btn{margin-top:18px;padding:12px 20px;border-radius:999px;background:#ffdf87;border:0;cursor:pointer;display:inline-flex;align-items:center;gap:10px;font:inherit;color:var(--text)}
.scene-loading{display:grid;place-items:center;min-height:60vh;font:22px Arial,sans-serif}
@media(max-width:820px){
 .placed-tag{min-width:0;font-size:clamp(13px,2.8vw,24px);padding:6px 8px}
 .script-ecole-mode .placed-tag,.dumont-mode .placed-tag{min-width:0;padding:6px 8px;font-size:clamp(18px,3.9vw,30px)!important}
 .words-top{flex-direction:row;align-items:center}
 .play-tip{font-size:11px}
 .home-intro h2{font-size:clamp(27px,7vw,44px)}
}
@media(prefers-reduced-motion:reduce){
 *,*::before,*::after{animation:none!important;transition:none!important}
}


/* Aperçus Premium visibles ; accès aux scènes toujours désactivé. */
.scene-locked:disabled{cursor:default;color:#667a8f;opacity:1;transform:none;box-shadow:none;background:#eef3f8;border-color:#dce5ee}
.scene-nav button.scene-link{border:0;font:inherit;font-size:14px;line-height:1;white-space:nowrap}
.locked-cover{position:relative;aspect-ratio:3/2;background:#e5eff8;overflow:hidden}
.locked-cover img{width:100%;height:100%;display:block;object-fit:cover;cursor:default}
.locked-ribbon{position:absolute;right:10px;bottom:10px;display:inline-flex;align-items:center;gap:6px;padding:7px 11px;border-radius:999px;background:rgba(255,255,255,.94);color:#4c667f;font-size:13px;box-shadow:0 3px 12px rgba(39,62,92,.12)}
.locked-card-btn{display:inline-flex;align-items:center;justify-content:center;padding:11px 15px;border-radius:999px;border:2px solid #dce5ee;font:inherit;font-size:14px}
.locked-card h3{color:#526d87}
.lock-icon{width:1em;height:1em;display:inline-block;vertical-align:-.12em;flex-shrink:0;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.scene-nav button.scene-link,.locked-card-btn{display:inline-flex;align-items:center;gap:6px}

/* Noms composés et étiquettes rapprochées des étals. */
.word{max-width:100%;white-space:normal}
.placed-tag{white-space:normal}
.tag-leaders{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:7;overflow:visible}
.tag-leaders line{stroke:#61796d;stroke-width:1.5;stroke-opacity:.75}
.tag-leaders circle{fill:#61796d;fill-opacity:.8}
