/* BAGARRE KART : l'éditeur de piste (src/ui/kartEditor.js). Plein écran, à la vraie définition (pas sur la grille
   640 × 360 des menus). Pensé pour quelqu'un qui n'y connaît rien : gros boutons, mots simples, une consigne en grand
   en haut de la vue. En vue 3D, le milieu est transparent : la piste y est dessinée par le jeu (Renderer.split). */
.ked {
  --bg: #12101a; --panel: #1c1928; --panel2: #2a253a; --line: #3e3856; --txt: #f0ecfa; --dim: #a8a2c4; --acc: #ffd23a; --hot: #ff2a7a; --ok: #3ad87a;
  position: absolute; inset: 0; z-index: 30; color: var(--txt);
  font: 16px/1.3 'Barlow Condensed', 'Arial Narrow', sans-serif;
  display: grid; grid-template-columns: 132px 1fr 330px; grid-template-rows: 54px 1fr 112px 26px;
  grid-template-areas: 'top top top' 'tools main side' 'tools prof side' 'bar bar bar';
  user-select: none;
}
.ked button { white-space: nowrap; font: inherit; color: var(--txt); background: var(--panel2); border: 2px solid var(--line); border-radius: 9px; padding: 5px 12px; cursor: pointer; transition: transform .08s, border-color .1s, background .1s; }
.ked button:hover:not(:disabled) { border-color: var(--acc); background: #352e4a; }
.ked button:active:not(:disabled) { transform: scale(.96); }
.ked button:disabled { opacity: .35; cursor: default; }
.ked input, .ked select { font: inherit; color: var(--txt); background: #0e0c14; border: 2px solid var(--line); border-radius: 7px; padding: 4px 8px; }
.ked input:focus, .ked select:focus { outline: none; border-color: var(--acc); }

/* the bar at the top */
.ked-top { grid-area: top; display: flex; align-items: center; gap: 7px; padding: 0 10px; background: var(--panel); border-bottom: 3px solid #000; }
.ked-logo { font: 26px Bangers, sans-serif; letter-spacing: 1px; color: var(--acc); text-shadow: 2px 2px 0 #000; margin-right: 6px; white-space: nowrap; }
.ked-name { width: 230px; font: 20px Bangers, sans-serif !important; letter-spacing: 1px; text-transform: uppercase; }
.ked-sp { flex: 1; }
.ked-save { background: #1f4a30 !important; border-color: #3ad87a !important; font-weight: 700; }
.ked-save.hot { animation: ked-pulse 1.6s ease-in-out infinite; }
@keyframes ked-pulse { 50% { box-shadow: 0 0 0 4px #3ad87a55; } }
.ked-go { background: #c81e5a !important; border-color: #ff6aa0 !important; font: 22px Bangers, sans-serif !important; letter-spacing: 1px; padding: 4px 16px !important; }
.ked-go:hover { background: #e8306e !important; }
.ked-go2 { padding: 4px 8px !important; margin-left: -6px; border-left-color: #8a1a3a !important; }

/* the tools on the left */
.ked-tools { grid-area: tools; display: flex; flex-direction: column; gap: 4px; padding: 6px; background: var(--panel); border-right: 3px solid #000; overflow-y: auto; }
.ked-th { font: 13px Bangers, sans-serif; letter-spacing: 1px; color: #ff8ac0; margin: 6px 2px 0; }
.ked-tool { display: flex !important; align-items: center; gap: 7px; text-align: left; padding: 5px 7px !important; }
.ked-tool i { font-style: normal; font-size: 20px; width: 24px; text-align: center; }
.ked-tool span { font-size: 15px; line-height: 1.05; white-space: normal; }
.ked-tool.on { background: #5a4410 !important; border-color: var(--acc) !important; box-shadow: 0 0 0 2px #ffd23a55; }

/* the view */
.ked-main { grid-area: main; position: relative; overflow: hidden; background: var(--bg); }
.ked-3d .ked-main { background: transparent; }
.ked-map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ked-say { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; max-width: calc(100% - 40px);
  background: #000c; border: 2px solid var(--acc); border-radius: 30px; padding: 6px 18px 6px 10px; font-size: 18px; pointer-events: none; box-shadow: 3px 3px 0 #000; }
.ked-say i { font-style: normal; font-size: 26px; }
.ked-say b { color: var(--acc); }
.ked-tip { position: absolute; display: none; pointer-events: none; background: #000d; border: 1px solid var(--acc); border-radius: 6px; padding: 3px 8px; font-size: 15px; white-space: nowrap; }
.ked-busy { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); background: #000c; border-radius: 20px; padding: 4px 14px; font-size: 15px; color: var(--acc); opacity: 0; transition: opacity .15s; pointer-events: none; }
.ked-busy.on { opacity: 1; }
.ked-nav { position: absolute; right: 10px; bottom: 10px; display: flex; gap: 5px; }
.ked-nav button { background: #000b; font-size: 20px; padding: 3px 11px; }
.ked-nav .ked-mode { font-size: 16px; }
.ked-toast { position: absolute; left: 50%; top: 120px; transform: translate(-50%, -10px); z-index: 45; background: #1a1430; border: 3px solid var(--acc); border-radius: 12px; padding: 10px 20px; font-size: 19px; box-shadow: 4px 4px 0 #000; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: 70vw; text-align: center; }
.ked-toast.on { opacity: 1; transform: translate(-50%, 0); }

/* the heights */
.ked-prof { grid-area: prof; border-top: 3px solid #000; position: relative; }
.ked-prof canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: ns-resize; }

/* the panel on the right */
.ked-side { grid-area: side; background: var(--panel); border-left: 3px solid #000; padding: 10px 14px 24px; overflow-y: auto; }
.ked-side h3 { font: 26px Bangers, sans-serif; letter-spacing: 1px; color: var(--acc); margin: 2px 0 8px; text-shadow: 2px 2px 0 #000; }
.ked-side h4 { font: 18px Bangers, sans-serif; letter-spacing: 1px; color: #ff8ac0; margin: 14px 0 6px; }
.ked-big { display: flex; gap: 6px; margin: 6px 0; }
.ked-big button { flex: 1; font-size: 17px; padding: 8px 6px; }
.ked-danger { border-color: #8a2a3a !important; color: #ffaab8 !important; }
.ked-ok2 { background: #1f5a35 !important; border-color: #3ad87a !important; }
.ked-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ked-cards3 { grid-template-columns: 1fr 1fr; }
.ked-cards button { display: grid; grid-template-columns: 30px 1fr; grid-template-rows: auto auto; text-align: left; padding: 6px 8px; white-space: normal; }
.ked-cards button i { font-style: normal; font-size: 22px; grid-row: span 2; align-self: center; }
.ked-cards button b { font-size: 16px; }
.ked-cards button small { color: var(--dim); font-size: 12px; line-height: 1.05; }
.ked-cards button.on { background: #5a4410; border-color: var(--acc); }
.ked-toggles { display: flex; flex-direction: column; gap: 5px; }
.ked-tog { display: grid !important; grid-template-columns: 30px 1fr auto; align-items: center; text-align: left; white-space: normal !important; padding: 6px 8px !important; }
.ked-tog i { font-style: normal; font-size: 20px; }
.ked-tog b { display: block; font-size: 16px; }
.ked-tog small { display: block; color: var(--dim); font-size: 12px; line-height: 1.1; }
.ked-tog em { font-style: normal; font: 15px Bangers, sans-serif; letter-spacing: 1px; padding: 2px 9px; border-radius: 12px; background: #3a3450; color: var(--dim); }
.ked-tog.on { border-color: #3ad87a; }
.ked-tog.on em { background: #3ad87a; color: #062a14; }
.ked-small { color: var(--dim); font-size: 14px; margin: 6px 0; }
.ked-warn { color: #ffc890; font-size: 15px; margin: 6px 0; padding: 6px 8px; border-left: 4px solid #ff8a2a; background: #2a1e14; border-radius: 0 6px 6px 0; }
.ked-warn button { font-size: 13px; padding: 1px 8px; margin-left: 4px; }
.ked-ok { color: #8affb0; font-size: 15px; }
.ked-steps { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 8px; }
.ked-steps div { display: flex; gap: 8px; align-items: center; font-size: 15px; }
.ked-steps span { flex: 1; }
.ked-steps b { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--acc); color: #000; font: 16px Bangers, sans-serif; }
.ked-y, .ked-p, .ked-g { font-style: normal; }
.ked-y { color: var(--acc); font-weight: 700; }
.ked-p { color: #ff6aa0; font-weight: 700; }
.ked-g { color: #3ad87a; font-weight: 700; }
.ked-howto { display: flex; gap: 10px; align-items: center; background: #241f34; border: 2px dashed var(--line); border-radius: 10px; padding: 10px; margin: 8px 0; }
.ked-howto i { font-style: normal; font-size: 34px; }
.ked-howto p { margin: 0; font-size: 16px; }
.ked-howto b { color: var(--acc); }
.ked-fine { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 6px; }
.ked-fine summary { cursor: pointer; color: var(--dim); font-size: 14px; }
.ked-f { display: grid; grid-template-columns: 1fr 110px; align-items: center; gap: 8px; margin: 4px 0; font-size: 14px; color: var(--dim); }
.ked-f input, .ked-f select { width: 100%; box-sizing: border-box; }
.ked-kits { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 6px 0; }
.ked-kits button { font-size: 14px; padding: 4px 6px; border-left: 6px solid var(--c); text-align: left; }
.ked-kits button.on { background: #5a4410; border-color: var(--acc); border-left-color: var(--c); }
.ked-search { width: 100%; box-sizing: border-box; margin: 4px 0; }
.ked-models { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; max-height: 32vh; overflow-y: auto; margin-bottom: 8px; }
.ked-models button { text-align: left; font-size: 13px; padding: 3px 7px; border-radius: 5px; white-space: normal; line-height: 1.05; }
.ked-models button.on { background: #5a4410; border-color: var(--acc); }

.ked-bar { grid-area: bar; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 0 10px; background: #0a0910; border-top: 1px solid var(--line); font-size: 13px; color: var(--dim); white-space: nowrap; overflow: hidden; }
.ked-hint { overflow: hidden; text-overflow: ellipsis; }

.ked-pop { position: fixed; z-index: 40; display: none; min-width: 280px; max-width: 340px; max-height: 70vh; overflow-y: auto; background: var(--panel); border: 3px solid var(--acc); border-radius: 10px; padding: 6px; box-shadow: 5px 5px 0 #000; }
.ked-pop.on { display: block; }
.ked-mi { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 17px; }
.ked-mi:hover { background: var(--panel2); }
.ked-mi.off { cursor: default; color: var(--dim); }
.ked-mi small { display: block; color: var(--dim); font-size: 12px; }
.ked-mi b { padding: 0 4px; opacity: .7; }
.ked-mi b:hover { opacity: 1; }
.ked-pop .ked-f { grid-template-columns: 60px 1fr; padding: 2px 6px 6px; }

/* the tutorial */
.ked-tuto { position: absolute; inset: 0; z-index: 50; display: none; place-items: center; background: #000a; }
.ked-tuto.on { display: grid; }
.ked-tcard { width: min(560px, 90vw); background: var(--panel); border: 4px solid var(--acc); border-radius: 18px; padding: 22px 28px; text-align: center; box-shadow: 8px 8px 0 #000; animation: ked-in .25s ease-out; }
@keyframes ked-in { from { transform: scale(.9) rotate(-1deg); } }
.ked-tcard > i { font-style: normal; font-size: 64px; display: block; }
.ked-tcard h2 { font: 34px Bangers, sans-serif; letter-spacing: 1px; color: var(--acc); margin: 6px 0; text-shadow: 3px 3px 0 #000; }
.ked-tcard p { font-size: 20px; line-height: 1.35; margin: 8px 0 14px; }
.ked-tcard p b { color: var(--acc); }
.ked-tcard .ked-big button { font-size: 20px; }
.ked-dots { display: flex; justify-content: center; gap: 8px; margin: 6px 0 12px; }
.ked-dots s { width: 12px; height: 12px; border-radius: 50%; background: var(--line); }
.ked-dots s.on { background: var(--acc); }

@media (max-width: 1100px) {
  .ked { grid-template-columns: 64px 1fr 280px; }
  .ked-tool span, .ked-th { display: none; }
  .ked-name { width: 140px; }
  .ked-logo { display: none; }
}

/* the little bar beside what is selected */
.ked-quick { position: absolute; display: none; gap: 4px; z-index: 5; background: #000c; border: 2px solid var(--acc); border-radius: 12px; padding: 4px; box-shadow: 3px 3px 0 #000; }
.ked-quick button { font-size: 19px; padding: 3px 9px; border-radius: 8px; }
.ked-save.done { background: #1a2a20 !important; border-color: #2a5a3a !important; color: #8affb0; }

/* « Par quoi on commence ? » */
.ked-pick { width: min(980px, 94vw); max-height: 88vh; overflow-y: auto; text-align: left; }
.ked-pick h2 { text-align: center; }
.ked-pick > .ked-small { text-align: center; font-size: 17px; }
.ked-pick h4 { font: 20px Bangers, sans-serif; letter-spacing: 1px; color: #ff8ac0; margin: 14px 0 6px; }
.ked-pgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 10px 0; }
.ked-pgrid button { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 12px 8px; white-space: normal; min-height: 132px; }
.ked-pgrid button i { font-style: normal; font-size: 40px; }
.ked-pgrid button b { font: 19px Bangers, sans-serif; letter-spacing: 1px; color: var(--acc); }
.ked-pgrid button small { color: var(--dim); font-size: 14px; line-height: 1.15; }
.ked-pmine { display: flex; flex-direction: column; gap: 5px; }
.ked-pmine div { display: flex; gap: 5px; }
.ked-pmine button:first-child { flex: 1; text-align: left; font-size: 17px; }
.ked-pmine small { margin-left: 10px; color: var(--dim); font-size: 13px; }
@media (max-width: 1100px) { .ked-pgrid { grid-template-columns: repeat(2, 1fr); } }
