/* Workshop : les defis solo (game/workshop.js, ui/workshop.js).
   La case dans S'entrainer, la fenetre des quatre defis, le tableau de bord
   en partie et l'ecran de fin avec sa medaille. */

/* --------------------------------------------- case S'entrainer --- */

/* Trois panneaux au lieu de deux : Libre, Contre un bot, Workshop. */
#training-choices { grid-template-columns: repeat(3, auto) !important; }
/* Trois cases plus etroites : sur telephone, « Contre un bot » passe a la
   ligne plutot que de deborder de sa case. */
#training-choices .mode-titre { white-space: normal; max-width: 100%; }
#btn-training-workshop { --img: url('menu/modes/entrainement.jpg?v=20260929'); }

/* ------------------------------------------------ les medailles --- */

/* Une pastille ronde au degrade du metal ; `data-m` : 0 aucune, 1 bronze,
   2 argent, 3 or. Sans medaille, elle s'efface. */
.wk-medaille {
  --m1: #f0b27a; --m2: #cd7f32; --m3: #7a4416;
  display: inline-block;
  width: 26px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--m1), var(--m2) 55%, var(--m3));
  box-shadow: 0 0 0 2px #0008, 0 0 14px color-mix(in srgb, var(--m2) 70%, transparent);
  position: relative;
}
.wk-medaille::after {
  content: '★';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font: 14px/1 system-ui, sans-serif;
  text-shadow: 0 1px 2px #0009;
}
.wk-medaille[data-m="0"] { visibility: hidden; }
.wk-medaille.grande[data-m="0"] { display: none; }
.wk-medaille[data-m="2"] { --m1: #ffffff; --m2: #c0c8d4; --m3: #6f7987; }
.wk-medaille[data-m="3"] { --m1: #fff3b0; --m2: #ffcf40; --m3: #b07a00; }

/* ------------------------------------------- la fenetre des defis --- */

#workshop-grille {
  display: grid;
  grid-template-columns: repeat(4, clamp(150px, 19vw, 290px));
  gap: clamp(10px, 1.6vw, 26px);
}
.wk-defi {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(6px, 1.2vh, 12px);
  min-height: min(48vh, 380px);
  padding: clamp(14px, 2.2vh, 24px) clamp(12px, 1.4vw, 22px);
  border: 2px solid #ffffff1f;
  border-radius: 16px;
  background:
    radial-gradient(120% 60% at 0% 0%, #8b5cf633, transparent 60%),
    linear-gradient(165deg, #171029, #080b14 70%);
  box-shadow: 0 22px 60px #000c;
  color: #fff;
  font: inherit;
  text-align: left;
  text-transform: none;
  letter-spacing: normal;
  clip-path: none;
  cursor: pointer;
  transition: border-color .25s ease, box-shadow .25s ease, transform .25s ease;
}
.wk-defi::after { content: none; }
.wk-defi:hover,
.wk-defi:focus-visible,
.wk-defi.pad-focus {
  outline: none;
  border-color: #f07a25aa;
  background:
    radial-gradient(120% 60% at 0% 0%, #f07a2533, transparent 60%),
    linear-gradient(165deg, #1d1330, #080b14 70%);
  box-shadow: 0 22px 60px #000c, 0 0 30px #f07a2533;
  transform: translateY(-4px);
}
.wk-defi > .wk-medaille { position: absolute; top: 12px; right: 12px; }
.wk-icone {
  width: clamp(30px, 3.4vw, 54px);
  height: auto;
  fill: none;
  stroke: var(--orange);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 10px #f07a2566);
}
.wk-nom {
  font: italic 800 clamp(15px, 1.7vw, 28px)/1.05 'Exo 2', var(--display);
  text-transform: uppercase;
  letter-spacing: .02em;
}
.wk-texte {
  flex: 1;
  color: #c9c1dd;
  font: 400 clamp(10px, .85vw, 13px)/1.45 var(--mono);
}
/* Les trois paliers, une pastille de metal devant chacun. */
.wk-paliers { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.wk-palier {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #e8e2f5;
  font: 700 clamp(10px, .8vw, 12px)/1 var(--mono);
}
.wk-palier::before {
  content: '';
  width: 10px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #cd7f32;
}
.wk-palier.m2::before { background: #c0c8d4; }
.wk-palier.m3::before { background: #ffcf40; }
.wk-record {
  width: 100%;
  padding-top: clamp(6px, 1vh, 10px);
  border-top: 1px solid #ffffff1a;
  color: var(--orange);
  font: 700 clamp(10px, .85vw, 13px)/1.2 var(--mono);
  letter-spacing: .06em;
}

/* --------------------------------------------- tableau de bord --- */

/* Pendant un defi, le compteur de score s'efface : le tableau du defi
   prend sa place, en haut au centre. */
#shell.workshop #scoreboard { display: none; }
#workshop-hud {
  position: absolute;
  top: clamp(6px, 1.4vh, 14px);
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: auto auto auto;
  align-items: baseline;
  column-gap: clamp(10px, 1.4vw, 22px);
  row-gap: 6px;
  padding: clamp(6px, 1vh, 10px) clamp(12px, 1.6vw, 22px);
  border: 1px solid #8b5cf655;
  border-radius: 14px;
  background: linear-gradient(160deg, #161029e6, #080b14e6);
  box-shadow: 0 10px 30px #000a;
  pointer-events: none;
}
#workshop-hud[hidden] { display: none; }
#workshop-hud .wk-titre {
  color: var(--orange);
  font: 700 clamp(9px, .8vw, 12px)/1 var(--mono);
  letter-spacing: .2em;
  text-transform: uppercase;
}
#workshop-hud .wk-progres,
#workshop-hud .wk-temps {
  font: italic 800 clamp(14px, 1.5vw, 24px)/1 'Exo 2', var(--display);
  white-space: nowrap;
}
#workshop-hud .wk-temps { min-width: 4.2em; text-align: right; font-variant-numeric: tabular-nums; }
#workshop-hud .wk-temps.urgent { color: #ff6a55; }
#workshop-hud .wk-pastilles {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  gap: clamp(3px, .4vw, 6px);
}
#workshop-hud .wk-pastilles i {
  width: clamp(7px, .7vw, 10px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: #ffffff2e;
}
#workshop-hud .wk-pastilles i.ok { background: #4ade80; box-shadow: 0 0 8px #4ade8099; }
#workshop-hud .wk-pastilles i.rate { background: #ff5a4f; }
#workshop-hud .wk-pastilles i.en-cours { background: transparent; box-shadow: inset 0 0 0 2px var(--orange); }

/* --------------------------------------------------- fin d'un defi --- */

#screen-workshop-fin.fin {
  display: grid;
  place-items: center;
  background: radial-gradient(90% 70% at 50% 45%, #0d0a1ad9, #04060af2);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
#screen-workshop-fin.fin[hidden] { display: none; }
.wk-fin[data-m="1"] { --c: #cd7f32; }
.wk-fin[data-m="2"] { --c: #c0c8d4; }
.wk-fin[data-m="3"] { --c: #ffcf40; }
.wk-medaille.grande { width: clamp(56px, 7vw, 96px); animation: wk-medaille .7s .15s cubic-bezier(.2, 1.5, .4, 1) both; }
.wk-medaille.grande::after { font-size: clamp(28px, 3.4vw, 48px); }
@keyframes wk-medaille { from { transform: scale(0) rotate(-40deg); } to { transform: scale(1) rotate(0); } }
#wf-titre {
  margin: 0;
  font: italic 800 clamp(30px, 4.6vw, 72px)/1 'Exo 2', var(--display);
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 0 34px var(--c), 0 4px 0 #0007;
}
#wf-score { color: #fff; }
#wf-sous.record { color: #4ade80; font-weight: 700; }
.wk-suivante { margin: 0; color: #a79fbd; font: 400 clamp(10px, .9vw, 13px)/1.4 var(--mono); }
#screen-workshop-fin .actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }
#screen-workshop-fin .actions button {
  min-width: 160px;
  padding: 12px 22px;
  border: 1px solid #ffffff26;
  border-radius: 12px;
  background: #0b0f18;
  color: #fff;
  font: italic 800 clamp(13px, 1.1vw, 17px)/1 'Exo 2', var(--display);
  letter-spacing: .06em;
  text-transform: uppercase;
  clip-path: none;
}
#screen-workshop-fin .actions button::after { content: none; }
#screen-workshop-fin .actions button.primary {
  border: 0;
  background: linear-gradient(#ff8f3f, var(--orange) 55%, #d85d0e);
  box-shadow: 0 10px 30px #f07a2544;
}
#screen-workshop-fin .actions button:hover,
#screen-workshop-fin .actions button.pad-focus { outline: none; border-color: #fff9; filter: brightness(1.12); box-shadow: 0 0 0 2px #fff6; }

/* ------------------------------------------------- telephone --- */

/* Telephone couche : quatre cartes plus basses, le texte des defis se
   resserre, la fin tient sans defiler. */
@media (max-height: 520px) and (orientation: landscape) {
  #workshop-grille { grid-template-columns: repeat(4, minmax(0, 1fr)); width: min(96vw, 860px); gap: 8px; }
  .wk-defi { min-height: 0; padding: 10px; gap: 5px; border-radius: 12px; }
  .wk-texte { font-size: 9.5px; line-height: 1.35; }
  .wk-icone { width: 26px; }
  .wk-defi > .wk-medaille { width: 20px; top: 8px; right: 8px; }
  .wk-defi > .wk-medaille::after { font-size: 11px; }
  #screen-workshop-fin .fin-carte { padding: 14px 18px; gap: 5px; }
  .wk-medaille.grande { width: 46px; }
  .wk-medaille.grande::after { font-size: 24px; }
  #wf-titre { font-size: 28px; }
  #screen-workshop-fin .fin-score { font-size: 28px; margin: 0; }
  #screen-workshop-fin .actions button { min-width: 0; padding: 9px 14px; }
}
