/* VR Studio — Écran d'accueil, menu pause, niveaux, options, commandes (2026-10-10)
 * JS : vrgame/js/game-shell.js · HTML : vrgame/index.php (#shell)
 * Tailles en em : l'option « Taille des textes : Grande » agrandit tout le menu d'un coup.
 * Côté de la main (html.shell-hand-left / .shell-hand-right) : les menus se placent sous le pouce.
 */

/* ── Conteneur ─────────────────────────────────────────────────────────────── */
.shell {
  --shell-accent: #f59e0b;
  --shell-accent-2: #f97316;
  --shell-ink: #fff7ed;
  --shell-text: #e5e7eb;
  --shell-muted: rgba(229, 231, 235, 0.68);
  --shell-card: rgba(10, 13, 24, 0.82);
  --shell-line: rgba(255, 255, 255, 0.12);
  --shell-focus: #fde047;
  position: fixed;
  inset: 0;
  z-index: 1000002;
  display: block;
  overflow: hidden;
  color: var(--shell-text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.shell.is-hidden { display: none; }
html.shell-text-large .shell { font-size: 19px; }

/* ── Fond : couverture du jeu animée, voile, halo ─────────────────────────── */
.shell-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: radial-gradient(120% 90% at 20% 10%, #1e293b 0%, #0b0f1a 55%, #05070d 100%);
}
.shell-bg-img {
  position: absolute;
  inset: -4%;
  width: 108%;
  height: 108%;
  object-fit: cover;
  filter: saturate(1.15) brightness(0.8);
  animation: shell-kenburns 38s ease-in-out infinite alternate;
}
.shell-bg-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(5, 7, 13, 0.92) 0%, rgba(5, 7, 13, 0.55) 45%, rgba(5, 7, 13, 0.25) 100%),
    linear-gradient(0deg, rgba(5, 7, 13, 0.85) 0%, rgba(5, 7, 13, 0) 45%);
}
.shell-bg-glow {
  position: absolute;
  inset: auto -20% -40% auto;
  width: 70vmax;
  height: 70vmax;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.22), rgba(245, 158, 11, 0) 65%);
  animation: shell-glow 9s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes shell-kenburns {
  from { transform: scale(1) translate3d(0, 0, 0); }
  to { transform: scale(1.12) translate3d(-2%, -1.5%, 0); }
}
@keyframes shell-glow {
  from { opacity: 0.55; transform: translate3d(0, 0, 0); }
  to { opacity: 1; transform: translate3d(-6%, -4%, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .shell-bg-img, .shell-bg-glow { animation: none; }
}

/* En cours de partie (pause) : on voit le jeu flouté derrière */
.shell.is-ingame .shell-bg { background: rgba(5, 7, 13, 0.55); backdrop-filter: blur(8px) saturate(0.8); -webkit-backdrop-filter: blur(8px) saturate(0.8); }
.shell.is-ingame .shell-bg-img,
.shell.is-ingame .shell-bg-glow { display: none; }
.shell.is-ingame .shell-bg-shade { background: linear-gradient(90deg, rgba(5, 7, 13, 0.75), rgba(5, 7, 13, 0.25)); }
html.shell-hand-right .shell.is-ingame .shell-bg-shade { background: linear-gradient(270deg, rgba(5, 7, 13, 0.75), rgba(5, 7, 13, 0.25)); }

/* ── Panneaux ──────────────────────────────────────────────────────────────── */
.shell-panel {
  position: absolute;
  inset: 0;
  display: none;
  padding: max(20px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  animation: shell-in 260ms ease-out;
}
.shell-panel.is-active { display: flex; }
@keyframes shell-in {
  from { opacity: 0; transform: translate3d(0, 10px, 0); }
  to { opacity: 1; transform: none; }
}

/* Écran titre : titre en haut à gauche, menu en bas du côté de la main */
.shell-panel-title {
  flex-direction: column;
  justify-content: space-between;
  gap: 1.2em;
}
.shell-title-block {
  max-width: 40em;
  padding-top: 2vh;
}
.shell-kicker {
  font-family: "Exo 2", system-ui, sans-serif;
  font-size: 0.78em;
  font-weight: 800;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--shell-accent);
}
.shell-game-title {
  margin: 0.15em 0 0;
  font-family: "Exo 2", system-ui, sans-serif;
  font-size: clamp(2.2em, 7vw, 4.6em);
  font-weight: 900;
  line-height: 0.98;
  letter-spacing: -0.01em;
  color: var(--shell-ink);
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.65), 0 0 40px rgba(245, 158, 11, 0.25);
  overflow-wrap: anywhere;
}
.shell-tagline {
  margin-top: 0.5em;
  font-size: 1.15em;
  font-weight: 700;
  color: #fde68a;
}
.shell-desc {
  margin-top: 0.6em;
  max-width: 34em;
  color: var(--shell-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.shell-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45em;
  margin-top: 0.9em;
}
.shell-chip {
  padding: 0.3em 0.75em;
  border: 1px solid var(--shell-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.8em;
  font-weight: 700;
  color: var(--shell-text);
}

.shell-chip-heavy { border-color: rgba(245, 158, 11, 0.5); background: rgba(245, 158, 11, 0.16); color: #fde68a; }

/* ── Menus et boutons ──────────────────────────────────────────────────────── */
.shell-menu {
  display: flex;
  flex-direction: column;
  gap: 0.55em;
  width: min(23em, 100%);
}
html.shell-hand-right .shell-panel-title .shell-menu { align-self: flex-end; }
html.shell-hand-left .shell-panel-title .shell-menu { align-self: flex-start; }

.shell-btn {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0.45em;
  min-height: 3.25em;
  padding: 0.6em 1.1em;
  border: 1px solid var(--shell-line);
  border-radius: 14px;
  background: rgba(15, 18, 32, 0.72);
  color: var(--shell-ink);
  font: inherit;
  font-size: 1.05em;
  font-weight: 700;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}
.shell-btn::before {
  content: "";
  position: absolute;
  left: 0;
  top: 22%;
  bottom: 22%;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--shell-accent);
  opacity: 0;
  transition: opacity 120ms ease;
}
.shell-btn:hover,
.shell-btn:focus-visible {
  background: rgba(30, 36, 60, 0.9);
  border-color: rgba(253, 224, 71, 0.55);
  transform: translateX(4px);
  outline: none;
}
.shell-btn:hover::before,
.shell-btn:focus-visible::before { opacity: 1; }
.shell-btn:focus-visible { box-shadow: 0 0 0 3px var(--shell-focus); }
.shell-btn.is-hidden { display: none; }
.shell-btn[disabled] { opacity: 0.45; cursor: not-allowed; }

.shell-btn-primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--shell-accent), var(--shell-accent-2));
  color: #1c1003;
  box-shadow: 0 10px 30px rgba(249, 115, 22, 0.35);
}
.shell-btn-primary:hover,
.shell-btn-primary:focus-visible {
  background: linear-gradient(135deg, #fbbf24, #fb923c);
  border-color: transparent;
}
.shell-btn-primary::before { background: #1c1003; }
/* Bouton sur deux lignes (Continuer + scène / score) */
.shell-btn-stack {
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
}
.shell-btn-main {
  font-family: "Exo 2", system-ui, sans-serif;
  font-size: 1.15em;
  font-weight: 900;
  letter-spacing: 0.02em;
}
.shell-btn-sub {
  font-size: 0.78em;
  font-weight: 700;
  opacity: 0.8;
}
.shell-btn-sub:empty { display: none; }
.shell-btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--shell-muted);
  min-height: 2.6em;
}
.shell-btn-danger {
  border-color: rgba(248, 113, 113, 0.6);
  background: rgba(127, 29, 29, 0.6);
}
.shell-btn-small {
  min-height: 2.6em;
  font-size: 0.92em;
}
.shell-btn-back {
  flex: 0 0 auto;
  align-items: center;
  width: 2.6em;
  min-height: 2.6em;
  padding: 0;
  font-size: 1.1em;
}

/* Chargement sous le menu */
.shell-loading {
  display: flex;
  align-items: center;
  gap: 0.7em;
  margin-top: 0.3em;
  font-size: 0.82em;
  color: var(--shell-muted);
  transition: opacity 400ms ease;
}
.shell.is-ready .shell-loading { opacity: 0; }
.shell-progress {
  flex: 1 1 auto;
  height: 6px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.12);
  -webkit-appearance: none;
  appearance: none;
}
.shell-progress::-webkit-progress-bar { background: rgba(255, 255, 255, 0.12); border-radius: 999px; }
.shell-progress::-webkit-progress-value { background: linear-gradient(90deg, var(--shell-accent), var(--shell-accent-2)); border-radius: 999px; transition: width 300ms ease; }
.shell-progress::-moz-progress-bar { background: linear-gradient(90deg, var(--shell-accent), var(--shell-accent-2)); border-radius: 999px; }
.shell-loading-text { flex: 0 0 auto; font-weight: 700; }
/* Clic sur Jouer avant la fin du chargement : le bouton patiente */
.shell.is-waiting .shell-btn-primary { animation: shell-pulse 1.1s ease-in-out infinite; }
.shell.is-waiting .shell-loading { opacity: 1; color: var(--shell-ink); }
@keyframes shell-pulse {
  0%, 100% { box-shadow: 0 10px 30px rgba(249, 115, 22, 0.35); }
  50% { box-shadow: 0 10px 44px rgba(249, 115, 22, 0.75); }
}

/* ── Panneaux latéraux (pause, options, commandes, niveaux) ───────────────── */
.shell-panel-side { align-items: stretch; }
html.shell-hand-right .shell-panel-side { justify-content: flex-end; }
html.shell-hand-left .shell-panel-side { justify-content: flex-start; }
.shell-side-card {
  display: flex;
  flex-direction: column;
  gap: 0.8em;
  width: min(30em, 100%);
  max-height: 100%;
  padding: 1.3em;
  overflow-y: auto;
  border: 1px solid var(--shell-line);
  border-radius: 20px;
  background: var(--shell-card);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overscroll-behavior: contain;
}
.shell-panel-wide .shell-side-card { width: min(46em, 100%); }
.shell-panel-side .shell-menu { width: 100%; }
.shell-panel-head {
  display: flex;
  align-items: center;
  gap: 0.7em;
}
.shell-h2 {
  margin: 0;
  font-family: "Exo 2", system-ui, sans-serif;
  font-size: 1.6em;
  font-weight: 900;
  color: var(--shell-ink);
}
.shell-lead {
  margin: 0;
  color: var(--shell-muted);
}
.shell-note {
  margin: 0.2em 0 0;
  font-size: 0.82em;
  color: var(--shell-muted);
}

/* Statistiques en pause */
.shell-pause-stats {
  display: flex;
  gap: 0.6em;
}
.shell-stat {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  padding: 0.6em 0.8em;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
}
.shell-stat-label {
  font-size: 0.72em;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--shell-muted);
}
.shell-stat-value {
  font-family: "Exo 2", system-ui, sans-serif;
  font-size: 1.35em;
  font-weight: 900;
  color: var(--shell-ink);
}

/* ── Panneaux centrés (choix de la main, confirmation) ────────────────────── */
.shell-panel-center {
  align-items: center;
  justify-content: center;
}
.shell-hand-card {
  display: flex;
  flex-direction: column;
  gap: 0.9em;
  width: min(34em, 100%);
  padding: 1.8em;
  border: 1px solid var(--shell-line);
  border-radius: 22px;
  background: var(--shell-card);
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.shell-hand-choices {
  display: flex;
  gap: 0.8em;
  justify-content: center;
}
.shell-hand-choices .shell-btn { flex: 1 1 0; align-items: center; text-align: center; }
.shell-hand-btn {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  gap: 0.4em;
  padding: 1.2em 0.8em;
  border: 2px solid var(--shell-line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--shell-ink);
  font: inherit;
  font-size: 1.15em;
  font-weight: 800;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}
.shell-hand-btn:hover,
.shell-hand-btn:focus-visible {
  border-color: var(--shell-focus);
  background: rgba(253, 224, 71, 0.1);
  transform: translateY(-2px);
  outline: none;
}
.shell-hand-icon { font-size: 2.6em; line-height: 1; }

/* ── Niveaux ───────────────────────────────────────────────────────────────── */
.shell-levels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11em, 1fr));
  gap: 0.7em;
}
.shell-level {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 9.5em;
  padding: 0;
  overflow: hidden;
  border: 2px solid var(--shell-line);
  border-radius: 16px;
  background: #111827;
  color: var(--shell-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease;
}
.shell-level:hover,
.shell-level:focus-visible {
  border-color: var(--shell-focus);
  transform: translateY(-2px);
  outline: none;
}
.shell-level-thumb {
  display: block;
  width: 100%;
  height: 5.4em;
  object-fit: cover;
  background: linear-gradient(135deg, #1e293b, #0f172a);
}
.shell-level-thumb-empty { background: linear-gradient(135deg, #312e81, #0f172a); }
.shell-level-num {
  position: absolute;
  top: 0.45em;
  left: 0.45em;
  min-width: 1.9em;
  padding: 0.1em 0.45em;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.7);
  font-family: "Exo 2", system-ui, sans-serif;
  font-weight: 900;
  text-align: center;
}
.shell-level-name {
  padding: 0.5em 0.7em 0;
  font-weight: 800;
}
.shell-level-state {
  padding: 0.15em 0.7em 0.6em;
  font-size: 0.8em;
  font-weight: 700;
  color: var(--shell-accent);
}
.shell-level.is-current { border-color: var(--shell-accent); }
.shell-level.is-locked { cursor: not-allowed; }
.shell-level.is-locked .shell-level-thumb { filter: grayscale(1) brightness(0.45); }
.shell-level.is-locked .shell-level-state { color: var(--shell-muted); }

/* ── Options ───────────────────────────────────────────────────────────────── */
.shell-options {
  display: flex;
  flex-direction: column;
  gap: 0.9em;
}
.shell-opt {
  display: flex;
  flex-direction: column;
  gap: 0.4em;
}
.shell-opt-label {
  font-size: 0.85em;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--shell-muted);
}
.shell-opt-label b { color: var(--shell-ink); }
.shell-opt-actions {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.5em;
}
.shell-seg {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35em;
  padding: 0.3em;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
}
.shell-seg-btn {
  flex: 1 1 auto;
  min-height: 2.6em;
  padding: 0.4em 0.8em;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--shell-text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.shell-seg-btn:hover { background: rgba(255, 255, 255, 0.08); }
.shell-seg-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--shell-focus); }
.shell-seg-btn.is-on {
  background: linear-gradient(135deg, var(--shell-accent), var(--shell-accent-2));
  color: #1c1003;
}
.shell-range {
  width: 100%;
  height: 2.2em;
  accent-color: var(--shell-accent);
  cursor: pointer;
}
.shell-range:focus-visible { outline: 3px solid var(--shell-focus); outline-offset: 2px; border-radius: 6px; }

/* ── Commandes ─────────────────────────────────────────────────────────────── */
.shell-controls {
  display: flex;
  flex-direction: column;
  gap: 0.8em;
}
.shell-controls-title {
  margin: 0.2em 0 0;
  font-size: 1.05em;
  font-weight: 800;
  color: var(--shell-ink);
}
.shell-keys {
  display: flex;
  flex-direction: column;
  gap: 0.35em;
  margin: 0;
}
.shell-key-row {
  display: grid;
  grid-template-columns: minmax(9em, 45%) 1fr;
  align-items: center;
  gap: 0.8em;
  padding: 0.45em 0.6em;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}
.shell-key-row dt { margin: 0; }
.shell-key-row dd { margin: 0; color: var(--shell-text); }
.shell-keys kbd {
  display: inline-block;
  min-width: 1.8em;
  padding: 0.15em 0.5em;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-bottom-width: 3px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--shell-ink);
  font-family: inherit;
  font-size: 0.88em;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
}
.shell-or {
  font-size: 0.75em;
  color: var(--shell-muted);
}

/* ── Petits écrans (téléphone en paysage / portrait) ──────────────────────── */
@media (max-width: 720px), (max-height: 480px) {
  .shell { font-size: 14px; }
  html.shell-text-large .shell { font-size: 17px; }
  .shell-panel { padding: max(12px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); }
  .shell-btn { min-height: 2.9em; }
  .shell-desc { -webkit-line-clamp: 2; }
  .shell-side-card { padding: 1em; border-radius: 16px; }
}
@media (max-height: 480px) and (orientation: landscape) {
  /* Paysage court : titre à gauche, menu à droite (ou l'inverse en main gauche) */
  .shell-panel-title { flex-direction: row; align-items: flex-end; justify-content: space-between; }
  html.shell-hand-left .shell-panel-title { flex-direction: row-reverse; }
  .shell-title-block { align-self: flex-start; max-width: 50%; }
  .shell-game-title { font-size: 2.3em; }
  .shell-menu { width: min(19em, 46%); gap: 0.4em; }
  .shell-desc { display: none; }
}

/* ── Tactile « une main » (option Commandes tactiles : Une main) ───────────────
 * Le joystick est dans le coin de la main utilisée et les boutons juste à côté, vers le centre :
 * le pouce passe de l'un à l'autre sans lâcher le téléphone. Le bouton ⇄ (changer de côté) est inutile ici. */
html.shell-onehand .mobile-pad-right .mobile-joystick { right: 16px; left: auto; bottom: 16px; }
html.shell-onehand .mobile-pad-right .mobile-pad-buttons { right: 180px; left: auto; bottom: 18px; }
html.shell-onehand .mobile-pad-left .mobile-joystick { left: 16px; right: auto; bottom: 16px; }
html.shell-onehand .mobile-pad-left .mobile-pad-buttons { left: 180px; right: auto; bottom: 18px; }
html.shell-onehand .mobile-pad-btn-side { display: none; }
