:root{--ink:#1d2547;--paper:#fff4dc;--paper2:#ffe9bd;--red:#f04e3e;--red2:#c93a2c;--yel:#ffc928;--teal:#1fb5a8;--teal2:#138a80;--mut:#6b6f86;--card:#fffaf0;--sh:4px 4px 0 var(--ink)}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;height:100%;background:var(--paper);color:var(--ink);font-family:"Trebuchet MS","Segoe UI",system-ui,-apple-system,Roboto,Arial,sans-serif;overflow:hidden;user-select:none;-webkit-user-select:none;touch-action:manipulation}
body{background-color:var(--paper);background-image:radial-gradient(rgba(29,37,71,.09) 1.3px,transparent 1.6px);background-size:14px 14px}
button{font:inherit;color:inherit;cursor:pointer}
#app{position:absolute;inset:0;display:flex;flex-direction:column;padding:10px 14px 6px;gap:8px;max-width:1280px;margin:0 auto}
#top{display:flex;align-items:center;justify-content:space-between;gap:8px}
#logo{display:flex;align-items:center;gap:8px;transform:rotate(-2deg)}
#logo b{background:var(--red);color:#fff;font-size:24px;font-weight:900;padding:3px 12px;border:3px solid var(--ink);border-radius:10px;box-shadow:var(--sh);letter-spacing:.5px;font-style:italic}
#logo span{background:var(--yel);font-weight:900;padding:2px 9px;border:3px solid var(--ink);border-radius:8px;box-shadow:3px 3px 0 var(--ink);font-size:15px}
#topBtns{display:flex;gap:7px}
.ib{height:40px;min-width:40px;border:3px solid var(--ink);background:var(--card);border-radius:11px;box-shadow:3px 3px 0 var(--ink);display:flex;align-items:center;justify-content:center;gap:5px;padding:0 8px;font-weight:800;font-size:14px}
.ib svg{width:21px;height:21px}
.ib:active{transform:translate(2px,2px);box-shadow:1px 1px 0 var(--ink)}
.ib.off{opacity:.5}
#bSound .x{display:none}#bSound.off .x{display:block}#bSound.off .w{display:none}
#opts{display:flex;flex-direction:column;gap:6px}
.row{display:flex;gap:7px;flex-wrap:wrap}
.chip{border:3px solid var(--ink);background:var(--card);border-radius:999px;padding:5px 13px 5px 9px;font-weight:800;font-size:14px;display:flex;align-items:center;gap:6px;box-shadow:3px 3px 0 var(--ink);white-space:nowrap}
.chip.d{padding:5px 14px}
.chip.on{background:var(--teal);color:#fff}
.chip.d.on{background:var(--yel);color:var(--ink)}
.chip.ghost{margin-left:auto}
.chip.ghost.on{background:#7a6cf0;color:#fff}
.chip:disabled{opacity:.45;cursor:default}
.chip.lock{opacity:.5}
.ico{display:inline-block;width:20px;height:20px;background:center/contain no-repeat;flex:none}
.m-left{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='5' y='2' width='14' height='20' rx='7' fill='%23fff' stroke='%231d2547' stroke-width='2'/%3E%3Cpath d='M12 2v8H5V9a7 7 0 0 1 7-7z' fill='%23f04e3e' stroke='%231d2547' stroke-width='2'/%3E%3C/svg%3E")}
.m-right{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='5' y='2' width='14' height='20' rx='7' fill='%23fff' stroke='%231d2547' stroke-width='2'/%3E%3Cpath d='M12 2v8h7V9a7 7 0 0 0-7-7z' fill='%23f04e3e' stroke='%231d2547' stroke-width='2'/%3E%3C/svg%3E")}
.m-space{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='1.5' y='8' width='21' height='9' rx='2.5' fill='%23ffc928' stroke='%231d2547' stroke-width='2'/%3E%3Cpath d='M7 12v2h10v-2' fill='none' stroke='%231d2547' stroke-width='1.8'/%3E%3C/svg%3E")}
.m-key{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='2' y='5' width='20' height='14' rx='2.5' fill='%23fff' stroke='%231d2547' stroke-width='2'/%3E%3Cg fill='%231d2547'%3E%3Crect x='5' y='8' width='3' height='3'/%3E%3Crect x='10.5' y='8' width='3' height='3'/%3E%3Crect x='16' y='8' width='3' height='3'/%3E%3Crect x='7' y='13' width='10' height='3'/%3E%3C/g%3E%3C/svg%3E")}
.m-touch{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 21l-4-6c-.6-1 .4-2.3 1.5-1.6L9 15V5a1.5 1.5 0 0 1 3 0v5l5.2 1a2 2 0 0 1 1.6 2.3L18 21z' fill='%23fff' stroke='%231d2547' stroke-width='2' stroke-linejoin='round'/%3E%3Ccircle cx='10.5' cy='4.5' r='3.5' fill='none' stroke='%23f04e3e' stroke-width='1.6'/%3E%3C/svg%3E")}
.m-ghost{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 21V10a8 8 0 0 1 16 0v11l-3-2-2.7 2-2.3-2-2.3 2L7 19z' fill='%23fff' stroke='%231d2547' stroke-width='2' stroke-linejoin='round'/%3E%3Ccircle cx='9' cy='10' r='1.6' fill='%231d2547'/%3E%3Ccircle cx='15' cy='10' r='1.6' fill='%231d2547'/%3E%3C/svg%3E")}
#main{flex:1;min-height:0;display:flex;gap:12px}
#arenaWrap{flex:1.6;min-width:0;display:flex}
#arena{position:relative;flex:1;border:4px solid var(--ink);border-radius:22px;box-shadow:6px 6px 0 var(--ink);overflow:hidden;outline:none;cursor:pointer;touch-action:none;
  background:repeating-conic-gradient(from 0deg at 50% 55%,#ffd75e 0 7.5deg,#ffe28a 7.5deg 15deg)}
#arena.run{background:repeating-conic-gradient(from 0deg at 50% 55%,#ff7a5c 0 7.5deg,#ff8f74 7.5deg 15deg)}
#arena.done{background:repeating-conic-gradient(from 0deg at 50% 55%,#7fd9cf 0 7.5deg,#97e2da 7.5deg 15deg)}
#arena.bad{cursor:not-allowed}
#fx{position:fixed;inset:0;width:100%;height:100%;pointer-events:none;z-index:15}
#target{position:absolute;left:50%;top:55%;width:min(46%,46vh,300px);aspect-ratio:1;transform:translate(-50%,-50%);z-index:2;pointer-events:none}
#tRing{position:absolute;inset:0;border-radius:50%;background:var(--red);border:5px solid var(--ink);box-shadow:0 9px 0 var(--ink),inset 0 -12px 0 var(--red2)}
#tCore{position:absolute;inset:16%;border-radius:50%;background:var(--card);border:4px solid var(--ink);display:flex;flex-direction:column;align-items:center;justify-content:center;box-shadow:inset 0 6px 0 rgba(29,37,71,.12)}
#tBig{font-size:clamp(34px,9vh,74px);font-weight:900;line-height:1;font-variant-numeric:tabular-nums}
#tSmall{font-weight:800;color:var(--mut);font-size:clamp(12px,2.2vh,17px);text-transform:uppercase;letter-spacing:1px}
#target.hit #tRing,#target.hit #tCore{transform:translateY(6px)}
#target.hit #tRing{box-shadow:0 3px 0 var(--ink),inset 0 -6px 0 var(--red2)}
#hint{position:absolute;left:0;right:0;bottom:12px;display:flex;justify-content:center;z-index:4;pointer-events:none}
#hintTxt{background:var(--ink);color:#fff;font-weight:800;padding:7px 16px;border-radius:999px;font-size:16px;animation:pulse 1.2s ease-in-out infinite}
#arena.run #hintTxt{animation:none;background:rgba(29,37,71,.75)}
@keyframes pulse{50%{transform:scale(1.06)}}
#turbo{position:absolute;left:3%;bottom:6px;width:min(24%,150px);z-index:4;pointer-events:none;transform-origin:50% 100%;filter:drop-shadow(3px 3px 0 rgba(29,37,71,.35))}
#turbo.bop{animation:bop .18s ease-out}
@keyframes bop{40%{transform:scale(1.06,.92)}}
#bubble{position:absolute;left:calc(3% + min(22%,140px));bottom:min(20%,130px);max-width:42%;background:#fff;border:3px solid var(--ink);border-radius:16px;padding:7px 11px;font-weight:800;font-size:14px;z-index:4;pointer-events:none;box-shadow:3px 3px 0 var(--ink)}
#bubble:empty{display:none}
#race{position:absolute;left:12px;right:12px;top:10px;z-index:4;pointer-events:none;display:none}
#race.show{display:block}
#track{position:relative;height:40px;background:rgba(255,255,255,.8);border:3px solid var(--ink);border-radius:12px}
.lane{position:absolute;left:8px;right:28px;top:50%;border-top:3px dashed rgba(29,37,71,.3)}
#flag{position:absolute;right:4px;top:5px;bottom:5px;width:18px;background:repeating-conic-gradient(var(--ink) 0 25%,#fff 0 50%) 0 0/9px 9px;border-radius:3px}
.runner{position:absolute;top:-6px;left:0;width:44px;height:44px;transform:translateX(-50%);transition:left .08s linear}
.runner img{width:44px;height:44px;object-fit:contain}
.runner b{position:absolute;left:50%;top:40px;transform:translateX(-50%);font-size:10px;background:var(--red);color:#fff;padding:0 5px;border-radius:5px;border:2px solid var(--ink);white-space:nowrap}
.runner.gh{opacity:.45;filter:grayscale(1) brightness(1.4)}
.runner.gh b{background:#7a6cf0}
#raceTxt{text-align:center;font-weight:900;font-size:14px;margin-top:20px;text-shadow:0 2px 0 #fff}
#side{flex:1;min-width:250px;max-width:400px;display:grid;grid-template-columns:1fr 1fr;grid-template-rows:auto auto auto 1fr;gap:9px}
.stat{background:var(--card);border:3px solid var(--ink);border-radius:14px;box-shadow:var(--sh);padding:6px 12px;display:flex;flex-direction:column}
.stat.big{grid-column:1/3;background:var(--ink);color:#fff;flex-direction:row;align-items:baseline;justify-content:space-between}
.stat.big b{font-size:52px;color:var(--yel)}
.lab{font-size:12px;font-weight:800;text-transform:uppercase;letter-spacing:1px;color:var(--mut)}
.stat.big .lab{color:#c9cbe0;font-size:15px}
.stat b{font-size:28px;font-weight:900;font-variant-numeric:tabular-nums;line-height:1.1}
#graphBox{grid-column:1/3;background:var(--card);border:3px solid var(--ink);border-radius:14px;box-shadow:var(--sh);padding:6px 9px;display:flex;flex-direction:column;min-height:120px}
.gh{display:flex;justify-content:space-between;font-size:12px;font-weight:800;color:var(--mut);gap:6px}
.leg i{display:inline-block;width:14px;height:4px;border-radius:2px;vertical-align:middle;margin:0 3px 0 6px}
.l1{background:var(--red)}.l2{background:#7a6cf0}
#graph{flex:1;width:100%;min-height:0}
#seo{margin:0;font-size:13px;color:var(--mut);text-align:center}
#seo b{color:var(--ink)}
/* overlays */
.ov{position:fixed;inset:0;background:rgba(29,37,71,.55);display:none;align-items:center;justify-content:center;z-index:20;padding:12px}
.ov.show{display:flex}
.card{background:var(--card);border:4px solid var(--ink);border-radius:22px;box-shadow:7px 7px 0 var(--ink);padding:16px 20px;max-width:520px;width:100%;max-height:100%;overflow:auto;position:relative;animation:pop .22s ease-out}
@keyframes pop{0%{transform:scale(.85);opacity:0}}
.card.wide{max-width:720px}
.card h1{margin:0;font-size:34px;font-style:italic;color:var(--red);text-shadow:3px 3px 0 var(--ink);-webkit-text-stroke:1px var(--ink)}
.card h1 em{display:inline-block;background:var(--yel);color:var(--ink);font-size:20px;padding:0 8px;border:3px solid var(--ink);border-radius:8px;text-shadow:none;-webkit-text-stroke:0;transform:rotate(-3deg);vertical-align:middle}
.card h2{margin:0 0 10px;font-size:24px}
.card h3{margin:12px 0 4px;font-size:17px}
.start{text-align:center}
.start .hero{width:130px;height:130px;object-fit:contain;margin:-6px auto 0;display:block}
.intro{font-size:16px;line-height:1.4;margin:8px 0}
.ctrls{display:flex;justify-content:center;gap:8px;flex-wrap:wrap;margin:6px 0 12px}
.ctrls div{border:3px solid var(--ink);border-radius:12px;padding:6px 8px;background:#fff;display:flex;flex-direction:column;align-items:center;gap:3px;font-size:12px;font-weight:800;min-width:72px}
.ctrls .ico{width:30px;height:30px}
.big{background:var(--red);color:#fff;border:4px solid var(--ink);border-radius:16px;box-shadow:0 6px 0 var(--ink);font-size:24px;font-weight:900;padding:10px 44px;letter-spacing:.5px}
.big:active{transform:translateY(4px);box-shadow:0 2px 0 var(--ink)}
.sec{background:#fff;border:3px solid var(--ink);border-radius:13px;box-shadow:0 4px 0 var(--ink);font-weight:800;font-size:16px;padding:9px 18px}
.small{font-size:13px;color:var(--mut);margin:8px 0 0}
.x{position:absolute;right:10px;top:8px;width:38px;height:38px;border:3px solid var(--ink);border-radius:10px;background:#fff;font-size:24px;font-weight:900;line-height:1}
.res{text-align:center;max-width:500px}
#newRec{display:none;background:var(--yel);border:3px solid var(--ink);border-radius:10px;font-weight:900;font-size:18px;padding:3px 12px;transform:rotate(-2deg);margin:0 auto 8px;width:max-content;box-shadow:3px 3px 0 var(--ink)}
#newRec.show{display:block;animation:pop .4s ease-out}
.rtop{display:flex;align-items:center;justify-content:center;gap:14px;text-align:left}
#rBadge{width:108px;height:108px;object-fit:contain}
.rtop b{display:block;font-size:56px;line-height:1;font-weight:900;color:var(--red);font-variant-numeric:tabular-nums}
.rtop .unit{display:block;font-weight:800;font-size:14px;color:var(--mut)}
#rRank{display:inline-block;margin-top:5px;background:var(--teal);color:#fff;border:3px solid var(--ink);border-radius:9px;padding:1px 10px;font-weight:900;font-size:18px}
#rNext{margin:8px 0 6px;font-weight:700;font-size:14px}
.grid{display:grid;grid-template-columns:repeat(4,1fr);gap:6px}
.grid div{border:3px solid var(--ink);border-radius:11px;background:#fff;padding:4px 2px}
.grid b{display:block;font-size:20px;font-weight:900}
.grid .lab{font-size:10px}
#rGhostTxt,#rFlag{margin:6px 0 0;font-weight:800;font-size:14px}
#rGhostTxt:empty,#rFlag:empty{display:none}
#rFlag{color:var(--red2)}
#rGraph{width:100%;height:90px;margin-top:6px;border:3px solid var(--ink);border-radius:11px;background:#fff}
.btns{display:flex;gap:10px;justify-content:center;align-items:center;margin-top:10px;flex-wrap:wrap}
.btns .big{font-size:22px;padding:8px 34px}
.tblWrap{overflow:auto}
table{border-collapse:collapse;width:100%;font-size:14px}
th,td{border:2px solid var(--ink);padding:5px 6px;text-align:center}
th{background:var(--paper2)}
td.has{font-weight:900}
td small{display:block;color:var(--mut);font-weight:700;font-size:11px}
#hist{margin:0;padding-left:22px;font-size:14px;line-height:1.6}
#hist:empty::before{content:"Aucun essai pour l'instant.";color:var(--mut)}
#ranks{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:12px}
#ranks div{display:flex;flex-direction:column;align-items:center;font-size:12px;font-weight:800;width:92px;text-align:center}
#ranks img{width:62px;height:62px}
#ranks small{color:var(--mut)}
.tip{border:3px solid var(--ink);border-radius:14px;background:#fff;padding:4px 12px 8px;margin-bottom:9px}
.tip p{margin:0;line-height:1.45;font-size:15px}
.tip.honest{background:var(--paper2)}
/* phone */
@media (max-width:760px) and (min-height:521px),(max-aspect-ratio:1/1){
  #app{padding:8px 10px 4px;gap:6px}
  #logo b{font-size:19px;padding:2px 9px}#logo span{font-size:12px}
  .ib.txt span{display:none}
  .ib{height:36px;min-width:36px;padding:0 6px}
  .row{flex-wrap:nowrap;overflow-x:auto;padding:0 2px 5px;scrollbar-width:none}
  .row::-webkit-scrollbar{display:none}
  .chip{font-size:13px;padding:4px 10px 4px 7px}
  .chip.ghost{margin-left:0}
  #main{flex-direction:column;gap:8px}
  #arenaWrap{flex:1}
  #side{max-width:none;min-width:0;grid-template-columns:1.25fr 1fr 1fr 1fr;grid-template-rows:auto 92px;flex:none;gap:6px}
  .stat{padding:3px 7px;box-shadow:3px 3px 0 var(--ink)}
  .stat.big{grid-column:auto;flex-direction:column;align-items:flex-start}
  .stat.big b{font-size:26px}
  .stat b{font-size:20px}
  .lab{font-size:10px}.stat.big .lab{font-size:10px}
  #graphBox{grid-column:1/5;min-height:0;padding:3px 7px;box-shadow:3px 3px 0 var(--ink)}
  #seo{font-size:11px}
  #target{width:min(58%,40vh,280px)}
  #turbo{width:min(26%,110px)}
  #bubble{font-size:12px;max-width:52%;left:calc(3% + min(24%,100px));bottom:min(24%,100px)}
  .grid{grid-template-columns:repeat(2,1fr)}
  .rtop b{font-size:44px}
  #rBadge{width:84px;height:84px}
  .card{padding:12px 14px}
  .card h1{font-size:28px}
  .start .hero{width:100px;height:100px}
}
.stat.rec{grid-column:1/3;flex-direction:row;align-items:baseline;justify-content:space-between}
@media (max-width:760px) and (min-height:521px),(max-aspect-ratio:1/1){.stat.rec{grid-column:auto;flex-direction:column;align-items:flex-start}.stat.rec .lab{font-size:0}.stat.rec .lab::before{content:"Record";font-size:10px}}
@media (max-height:520px) and (min-aspect-ratio:1/1){
  #app{padding:5px 10px 4px;gap:5px}
  #top{position:absolute;left:10px;right:10px;top:5px;pointer-events:none}#top>*{pointer-events:auto}
  #logo b{font-size:16px;padding:1px 8px;border-width:2px}#logo span{display:none}
  .ib{height:30px;min-width:30px;padding:0 5px;border-width:2px;box-shadow:2px 2px 0 var(--ink)}.ib.txt span{display:none}
  #opts{flex-direction:row;gap:5px;margin:0 140px 0 110px;overflow-x:auto;scrollbar-width:none}
  .row{flex-wrap:nowrap;gap:4px}
  .chip{font-size:11px;padding:2px 7px 2px 5px;border-width:2px;box-shadow:2px 2px 0 var(--ink)}.chip .ico{width:14px;height:14px}
  .chip.ghost{margin-left:0}
  #seo{display:none}
  #side{min-width:200px;max-width:240px;gap:5px}
  .stat{padding:2px 8px;border-width:2px;box-shadow:2px 2px 0 var(--ink)}
  .stat.big b{font-size:30px}.stat b{font-size:18px}.lab{font-size:9px}
  #graphBox{min-height:60px;border-width:2px;box-shadow:2px 2px 0 var(--ink)}
  #arena{border-width:3px;box-shadow:4px 4px 0 var(--ink)}
  #target{width:min(40%,60vh)}#tBig{font-size:clamp(26px,12vh,60px)}
  #bubble{font-size:11px}#race{top:4px}#track{height:30px}.runner img{width:34px;height:34px}.runner{width:34px;height:34px}.runner b{top:30px}#raceTxt{margin-top:12px;font-size:11px}
  .card{max-height:96vh;padding:8px 14px}.start .hero{width:60px;height:60px}.card h1{font-size:22px}.intro{font-size:13px;margin:4px 0}.ctrls{margin:2px 0 6px}.ctrls div{padding:2px 5px;min-width:56px}.ctrls .ico{width:20px;height:20px}
  .big{font-size:18px;padding:5px 30px}#rBadge{width:60px;height:60px}.rtop b{font-size:34px}#rGraph{height:56px}.grid b{font-size:15px}
}
.gh .leg{white-space:nowrap}@media (max-height:520px) and (min-aspect-ratio:1/1){.gh>span:first-child{display:none}}
/* embed-fit: option chips wrap instead of scrolling sideways, so every chip stays inside the small store frame */
#logo b,#logo span{white-space:nowrap}
@media (max-width:760px) and (min-height:521px),(max-aspect-ratio:1/1){
  .row{flex-wrap:wrap;overflow:visible;padding:0 2px 2px;gap:6px}
  #opts{gap:5px}
}
@media (max-width:420px){
  .chip{font-size:12px;padding:3px 8px 3px 6px}.chip.d{padding:3px 10px}.chip .ico{width:16px;height:16px}
  #logo span{display:none}
}
@media (max-height:520px) and (min-aspect-ratio:1/1){
  #app{display:grid;grid-template-columns:auto 1fr auto;grid-template-rows:auto 1fr;column-gap:8px;row-gap:5px;align-items:start}
  #top{display:contents}
  #logo{grid-column:1;grid-row:1;padding-top:2px}
  #topBtns{grid-column:3;grid-row:1;gap:5px}
  #opts{grid-column:2;grid-row:1;margin:0;overflow:visible;flex-direction:row;flex-wrap:wrap;gap:4px 5px;justify-content:center}
  .row{flex-wrap:wrap;overflow:visible;padding:0;gap:4px;justify-content:center}
  #main{grid-column:1/4;grid-row:2;align-self:stretch;min-height:0}
  .card{max-height:94vh;overflow:auto}
}
@media (max-height:520px){
  .ov{padding:8px}
  .res{max-width:560px}
  #newRec{font-size:14px;margin-bottom:2px;padding:1px 10px}
  .rtop{gap:10px}.rtop .unit{font-size:12px}#rRank{font-size:14px;margin-top:2px}
  #rNext{margin:3px 0;font-size:12px}
  .grid{grid-template-columns:repeat(4,1fr);gap:4px}.grid div{padding:1px 2px;border-width:2px}.grid b{font-size:15px}.grid .lab{font-size:9px}
  #rGhostTxt,#rFlag{margin-top:3px;font-size:12px}
  #rGraph{height:50px;margin-top:4px;border-width:2px}
  #rKeys{display:none}
  .res .btns{position:sticky;bottom:-8px;background:var(--card);margin:4px -14px -8px;padding:6px 8px 8px}
  .btns .big{font-size:17px;padding:4px 26px}.sec{font-size:14px;padding:5px 14px}
  .x{width:32px;height:32px;font-size:20px;top:6px;right:8px;position:sticky;float:right;margin-left:8px}
}
