/* Lettres en Vrac — grandes cibles tactiles, couleurs gaies, polices système arrondies. */
:root { --bg: #fff6e5; --card: #ffffff; --ink: #2e2a4f; --muted: #6b6788; --a: #ff7a59; --b: #3cb4a8; --c: #8a6cf0; --d: #ffc23d; --ok: #2f9e5e; --bad: #e0483d;
  --s0: #ffe0d6; --s1: #d7f2ee; --font: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif; color-scheme: light; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--bg) radial-gradient(circle at 10% 0%, #ffe9c2 0, transparent 40%) fixed; color: var(--ink); font: 18px/1.4 var(--font); -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; touch-action: manipulation; }
main { max-width: 760px; margin: 0 auto; padding: calc(10px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
[hidden] { display: none !important; }
:focus-visible { outline: 4px solid var(--c); outline-offset: 3px; }
.muted { color: var(--muted); } .center { text-align: center; }
.loading { text-align: center; padding-top: 30vh; color: var(--muted); }
.warn { background: #fff; border: 3px solid var(--d); border-radius: 18px; padding: 10px 14px; font-weight: 700; color: var(--ink); box-shadow: 0 4px 0 #eadcc2; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 8px 18px; border: 0; border-radius: 18px; background: var(--card); box-shadow: 0 4px 0 #e8d9bd; font-weight: 800; cursor: pointer; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #e8d9bd; }
.btn.primary { background: var(--a); color: #fff; box-shadow: 0 5px 0 #d65a3b; }
.btn.danger { color: var(--bad); margin-top: 14px; }
.btn.big { min-height: 60px; font-size: 1.05rem; }
.btn.huge { width: 100%; min-height: 76px; font-size: 1.6rem; border-radius: 24px; margin: 18px 0 10px; }
.btn[disabled] { opacity: .45; }
.round-btn { width: 52px; height: 52px; flex: none; border: 0; border-radius: 50%; background: var(--card); box-shadow: 0 3px 0 #e8d9bd; font-size: 1.4rem; cursor: pointer; display: grid; place-items: center; }
.round-sp { width: 52px; }
/* Accueil */
.hero { text-align: center; margin: 14px 0 18px; }
.brand { margin: 0; font-size: clamp(2.6rem, 13vw, 4rem); line-height: 1; letter-spacing: .02em; }
.brand span { display: inline-block; color: #fff; text-shadow: 0 3px 0 #0002; }
.brand .b1 { color: var(--a); transform: rotate(-6deg); } .brand .b2 { color: var(--b); transform: rotate(5deg) translateY(4px); } .brand .b3 { color: var(--c); transform: rotate(-3deg); } .brand .b4 { color: var(--d); transform: rotate(8deg) translateY(-3px); }
.brand small { display: block; font-size: .42em; color: var(--ink); margin-top: 6px; }
.tag { margin: 8px 0 0; color: var(--muted); font-weight: 700; }
.levels { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.level { display: flex; align-items: center; gap: 10px; min-height: 70px; padding: 8px 12px; border: 3px solid transparent; border-radius: 20px; background: var(--card); box-shadow: 0 4px 0 #eadcc2; text-align: left; cursor: pointer; }
.level:last-child { grid-column: 1 / -1; }
.level.on { border-color: var(--b); background: #effaf8; }
.lv-ic { width: 44px; height: 44px; flex: none; } .lv-ic .pic { width: 44px; height: 44px; }
.ab-ic { width: 30px; height: 30px; display: inline-flex; } .ab-ic .pic { width: 30px; height: 30px; }
.lv-t { display: flex; flex-direction: column; line-height: 1.2; }
.lv-t small { color: var(--muted); font-weight: 600; font-size: .82rem; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; }
.row-l { font-weight: 800; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.seg-b { min-height: 48px; min-width: 64px; padding: 6px 14px; border: 3px solid transparent; border-radius: 14px; background: var(--card); box-shadow: 0 3px 0 #eadcc2; font-weight: 800; cursor: pointer; }
.seg-b.on { border-color: var(--c); background: #f1ecff; }
.home-links { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.count { background: var(--bg); border-radius: 99px; padding: 1px 9px; font-size: .85rem; }
.foot { text-align: center; color: var(--muted); font-size: .8rem; margin-top: 22px; }
/* Partie */
#game { display: flex; flex-direction: column; min-height: calc(100dvh - 30px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
.gbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.gbar h2 { margin: 0; font-size: 1.15rem; text-align: center; }
.dots { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.dots span { width: 12px; height: 12px; border-radius: 50%; background: #eadcc2; }
.dots span.done { background: var(--b); } .dots span.cur { background: var(--a); transform: scale(1.35); }
.stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: space-evenly; gap: 10px; padding-top: 6px; }
.figure { position: relative; margin: 0; width: min(44vw, 30dvh, 230px); aspect-ratio: 1; display: grid; place-items: center; background: var(--card); border-radius: 32px; box-shadow: 0 8px 0 #eadcc2; }
.pic { width: 100%; height: 100%; }
.pic.big { width: 78%; height: 78%; }
.won .figure { animation: hop .6s ease; }
@keyframes hop { 40% { transform: translateY(-14px) scale(1.05); } }
.stars { position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%); display: flex; gap: 2px; font-size: 1.8rem; background: var(--card); border-radius: 99px; padding: 0 10px; box-shadow: 0 3px 0 #eadcc2; }
.stars span { color: #e6dcc8; } .stars span.on { color: var(--d); animation: pop .4s ease both; }
.stars span:nth-child(2) { animation-delay: .12s; } .stars span:nth-child(3) { animation-delay: .24s; }
@keyframes pop { from { transform: scale(0); } }
.model { min-height: 1.6em; margin: 6px 0 0; font-size: 1.5rem; font-weight: 800; letter-spacing: .12em; color: var(--muted); opacity: 0; transition: opacity .3s; }
.model.on { opacity: 1; }
.model .m0 { color: var(--a); } .model .m1 { color: var(--b); }
.slots, .tiles { display: flex; flex-wrap: wrap; justify-content: center; width: 100%; }
.slots { gap: 4px; --w: min(60px, calc((100vw - 40px - (var(--n) - 1) * 6px) / var(--n))); }
.slot { width: var(--w); height: calc(var(--w) * 1.15); min-width: 26px; border: 0; border-bottom: 5px solid #cfc2a8; border-radius: 12px 12px 6px 6px; background: #fffaf0; font-size: calc(var(--w) * .66); font-weight: 900; padding: 0; display: grid; place-items: center; }
.slots.syl .slot.gap { margin-left: 8px; }
.slots.syl .slot.s0.full { background: var(--s0); } .slots.syl .slot.s1.full { background: var(--s1); }
.slot.full { background: #fff; border-bottom-color: var(--c); animation: drop .25s ease; }
.slot.ok { border-bottom-color: var(--ok); }
.slot.bad { border-bottom-color: var(--bad); color: var(--bad); animation: shake .4s; }
@keyframes drop { from { transform: translateY(-14px); opacity: .3; } }
.tiles { gap: 10px; max-width: 520px; }
.tile { width: 62px; height: 66px; border: 0; border-radius: 18px; background: var(--card); box-shadow: 0 5px 0 #d9c9aa; font-size: 2.1rem; font-weight: 900; cursor: pointer; transition: opacity .2s, transform .2s; }
.tile:nth-child(4n+1) { color: var(--a); } .tile:nth-child(4n+2) { color: var(--b); } .tile:nth-child(4n+3) { color: var(--c); } .tile:nth-child(4n) { color: #d99a00; }
.tile:active { transform: translateY(4px); box-shadow: 0 1px 0 #d9c9aa; }
.tile.used { opacity: .18; transform: scale(.85); box-shadow: none; }
.tile.shake { animation: shake .4s; }
.tile.hint { animation: glow 1s infinite; }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
@keyframes glow { 50% { box-shadow: 0 0 0 6px var(--d), 0 5px 0 #d9c9aa; transform: scale(1.08); } }
.actions { min-height: 64px; display: flex; gap: 10px; justify-content: center; }
.next { min-width: 200px; font-size: 1.3rem; animation: pop .35s ease; }
/* Album */
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; margin-top: 10px; }
.card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 6px; border: 0; border-radius: 18px; background: var(--card); box-shadow: 0 4px 0 #eadcc2; cursor: pointer; }
.card .pic { width: 60px; height: 60px; }
.card.locked .pic { filter: brightness(0); opacity: .12; }
.card-w { font-weight: 800; font-size: .85rem; }
.card-s { color: var(--d); font-size: .8rem; letter-spacing: -1px; }
/* Dialogues */
dialog { border: 0; border-radius: 26px; padding: 0; width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 30px); background: var(--bg); color: var(--ink); box-shadow: 0 20px 60px #2e2a4f55; }
dialog::backdrop { background: #2e2a4f77; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 0 20px; }
.dlg-head h2 { margin: 0; }
.dlg-body { padding: 8px 20px 10px; overflow: auto; }
.dlg-actions { display: flex; gap: 10px; justify-content: flex-end; padding: 6px 20px calc(18px + env(safe-area-inset-bottom)); }
.opt { border: 0; padding: 0; margin: 0 0 14px; }
.opt legend { font-weight: 800; margin-bottom: 6px; }
.switch { display: flex; align-items: center; gap: 12px; min-height: 52px; font-weight: 700; cursor: pointer; }
.switch input { appearance: none; -webkit-appearance: none; width: 52px; height: 32px; flex: none; margin: 0; border-radius: 99px; background: #d6ccb8; position: relative; cursor: pointer; }
.switch input::after { content: ""; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked { background: var(--b); } .switch input:checked::after { transform: translateX(20px); }
.end-stars { font-size: 2rem; font-weight: 900; color: #d99a00; text-align: center; margin: 4px 0; }
.end-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.end-i { display: flex; flex-direction: column; align-items: center; background: var(--card); border-radius: 14px; padding: 6px; font-weight: 800; font-size: .85rem; }
.end-i .pic { width: 48px; height: 48px; } .end-i small { color: var(--d); }
/* Paysage et grands écrans : image à gauche, lettres à droite */
@media (orientation: landscape) and (max-height: 560px) {
  main { max-width: none; }
  .stage { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto auto auto; align-content: center; column-gap: 24px; justify-items: center; }
  .figure { grid-row: 1 / 5; width: min(36vw, 62dvh); }
  .slots { --w: min(52px, calc((58vw - (var(--n) - 1) * 6px) / var(--n))); }
  .tile { width: 54px; height: 56px; font-size: 1.8rem; }
  .brand { font-size: 2.6rem; }
}
@media (min-width: 700px) and (min-height: 700px) { .figure { width: min(34vh, 280px); } .tile { width: 72px; height: 76px; font-size: 2.5rem; } }
@media (max-width: 360px) { .tile { width: 54px; height: 58px; font-size: 1.8rem; } .levels { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
/* Confirmation et message d'erreur */
dialog.confirm { width: min(400px, calc(100vw - 32px)); text-align: center; }
.cf-body { padding: 24px 22px 6px; }
.cf-ic { width: 72px; height: 72px; margin: 0 auto 6px; } .cf-ic .pic { width: 72px; height: 72px; }
.cf-body h2 { margin: 0 0 8px; font-size: 1.3rem; }
.cf-body p { margin: 0; color: var(--muted); font-weight: 600; }
.cf-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 18px 20px calc(20px + env(safe-area-inset-bottom)); }
.btn.warnbtn { background: var(--bad); color: #fff; box-shadow: 0 5px 0 #b3342b; }
.oops { max-width: 360px; margin: 0 auto; background: var(--card); border-radius: 26px; padding: 22px; box-shadow: 0 6px 0 #eadcc2; }
.oops-t { font-size: 2rem; font-weight: 900; color: var(--a); margin: 0 0 6px; }
.oops p:not(.oops-t) { color: var(--ink); }
