/* Zigzag — styles du site, d'après la maquette Claude Design « Connexion Zigzag » (variante 2b). */

:root {
  --night: #0B1330;
  --grass: #3C8A2E;
  --grass-busy: #356F2A;
  --grass-edge: #5DB53B;
  --sprout: #7ED957;
  --earth: #1F4D17;
  --redstone: #FF6B6B;

  --text: #fff;
  --text-label: rgba(255, 255, 255, .86);
  --text-muted: rgba(255, 255, 255, .8);
  --text-placeholder: rgba(255, 255, 255, .5);

  --glass: rgba(8, 12, 32, .6);
  --glass-border: rgba(170, 190, 255, .24);
  --glass-shadow: 0 30px 70px rgba(0, 0, 15, .55);

  /* Case d'inventaire : fond sombre creusé par un biseau sombre en haut à gauche, clair en bas à droite */
  --slot-bg: rgba(0, 0, 0, .45);
  --slot-bevel: inset 2px 2px 0 rgba(0, 0, 0, .5), inset -2px -2px 0 rgba(255, 255, 255, .12);
  --ring-focus: 0 0 0 3px rgba(126, 217, 87, .55);
  --ring-error: 0 0 0 2px rgba(255, 107, 107, .75);

  --font-ui: Inter, system-ui, sans-serif;
  --font-pixel: 'Press Start 2P', monospace;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--night);
  color: var(--text);
  font: 400 15px/1.4 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Décor et mise en page ---------- */

.scene {
  position: fixed;
  inset: 0;
  display: block;
  width: 100vw;
  height: 100vh;
  height: 100lvh;
  image-rendering: pixelated;
}

/* Panneau de connexion centré sur le décor */
.stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 32px clamp(16px, 4.7vw, 56px);
}

.panel {
  display: flex;
  flex-direction: column;
  width: 470px;
  max-width: 100%;
  padding: 48px 48px 44px;
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  backdrop-filter: blur(18px) saturate(1.3);
  box-shadow: var(--glass-shadow);
}

.brand {
  margin: 0;
  font: 400 24px/1.3 var(--font-pixel);
  text-shadow: 3px 3px 0 #000;
}

.subtitle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 0;
  font: 500 14px var(--font-ui);
  color: var(--text-muted);
}

.status-dot {
  flex: none;
  width: 6px;
  height: 6px;
  background: var(--sprout);
  box-shadow: 0 0 10px var(--sprout);
}

.spacer { flex: 1; min-height: 24px; }

/* ---------- Formulaire de connexion ---------- */

.login { min-height: 532px; }

.fields {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 34px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field > label {
  font: 500 13px var(--font-ui);
  color: var(--text-label);
}

.slot {
  border-radius: 4px;
  background: var(--slot-bg);
  box-shadow: var(--slot-bevel);
}

.input {
  flex: 1;
  min-width: 0;
  height: 48px;
  padding: 0 14px;
  border: 0;
  color: var(--text);
  font: 400 15px var(--font-ui);
  outline: none;
  transition: box-shadow .15s;
}

.input::placeholder { color: var(--text-placeholder); }
.input:focus { box-shadow: var(--slot-bevel), var(--ring-focus); }
.has-error .input:not(:focus) { box-shadow: var(--slot-bevel), var(--ring-error); }
.input:disabled { color: rgba(255, 255, 255, .7); }

/* Garde le fond sombre quand le navigateur remplit les champs tout seul */
.input:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  box-shadow: var(--slot-bevel), inset 0 0 0 100px #0C1124;
}
.input:-webkit-autofill:focus { box-shadow: var(--slot-bevel), inset 0 0 0 100px #0C1124, var(--ring-focus); }

.pseudo-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar-slot {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
}

.avatar-slot img {
  width: 36px;
  height: 36px;
  image-rendering: pixelated;
}

.password-row {
  position: relative;
  display: flex;
}

.password-row .input { padding-right: 92px; }

.toggle-password {
  position: absolute;
  top: 8px;
  right: 8px;
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 3px;
  background: rgba(255, 255, 255, .12);
  color: var(--text);
  font: 500 12px var(--font-ui);
  cursor: pointer;
}

.toggle-password:hover { background: rgba(255, 255, 255, .2); }

.remember {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  margin-top: 16px;
  font: 400 14px var(--font-ui);
  color: rgba(255, 255, 255, .9);
  cursor: pointer;
  user-select: none;
}

.remember:has(input:disabled) { cursor: default; }

.remember input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.checkbox {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, .4);
  border-radius: 2px;
  background: rgba(255, 255, 255, .08);
}

.checkbox svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  visibility: hidden;
}

.remember input:checked + .checkbox { border-color: var(--grass-edge); background: var(--grass); }
.remember input:checked + .checkbox svg { visibility: visible; }
.remember input:focus-visible + .checkbox { outline: 2px solid var(--sprout); outline-offset: 2px; }

.error {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  color: #FFC4C4;
  font: 500 13.5px var(--font-ui);
}

.error-dot {
  flex: none;
  width: 8px;
  height: 8px;
  background: var(--redstone);
  box-shadow: 0 0 8px var(--redstone);
}

/* ---------- Boutons ---------- */

/* Bouton principal en relief, façon bouton du jeu */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 52px;
  border: 0;
  border-radius: 4px;
  background: var(--grass);
  color: var(--text);
  font: 700 15px var(--font-ui);
  text-shadow: 0 2px 0 rgba(0, 0, 0, .3);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, .22),
    inset 0 -4px 0 rgba(0, 0, 0, .3),
    0 4px 0 var(--earth),
    0 10px 30px rgba(126, 217, 87, .18);
  cursor: pointer;
  transition: filter .15s;
}

a.btn-primary { text-decoration: none; }
.btn-primary:hover { filter: brightness(1.12); }
.btn-primary:active { transform: translateY(2px); }
.btn-primary:disabled { cursor: progress; }
.is-loading .btn-primary { background: var(--grass-busy); filter: none; transform: none; }

.btn-secondary {
  height: 44px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 4px;
  background: rgba(255, 255, 255, .1);
  color: var(--text);
  font: 600 14px var(--font-ui);
  cursor: pointer;
}

.btn-secondary:hover { background: rgba(255, 255, 255, .18); }

.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.toggle-password:focus-visible {
  outline: 2px solid var(--sprout);
  outline-offset: 3px;
}

/* Trois carrés qui clignotent pendant une attente */
.dots { display: inline-flex; gap: 4px; }
.login .dots { display: none; }
.login.is-loading .dots { display: inline-flex; }

.dots span {
  width: 6px;
  height: 6px;
  background: #fff;
  animation: blink .9s infinite;
}

.dots span:nth-child(2) { animation-delay: .15s; }
.dots span:nth-child(3) { animation-delay: .3s; }

@keyframes blink {
  0%, 100% { opacity: .25; }
  50% { opacity: 1; }
}

/* ---------- Pages connectées : en-tête, navigation ---------- */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.app {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 36px;
  height: 72px;
  padding: 0 28px;
  border-bottom: 1px solid var(--glass-border);
  background: var(--glass);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  backdrop-filter: blur(18px) saturate(1.3);
}

.brand--small {
  color: inherit;
  font-size: 17px;
  line-height: 1;
  text-decoration: none;
  text-shadow: 2px 2px 0 #000;
  white-space: nowrap;
}

.tabs { display: flex; gap: 6px; }

.tab {
  padding: 9px 14px;
  border-radius: 4px;
  color: rgba(255, 255, 255, .8);
  font: 500 14px var(--font-ui);
  text-decoration: none;
}

.tab:hover { background: rgba(255, 255, 255, .08); color: var(--text); }

.tab[aria-current="page"] {
  background: var(--slot-bg);
  box-shadow: var(--slot-bevel), inset 0 -3px 0 var(--sprout);
  color: var(--text);
  font-weight: 600;
}

.tab.is-soon { color: rgba(255, 255, 255, .45); cursor: default; }
.tab.is-soon:hover { background: none; }

.soon {
  margin-left: 4px;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, .1);
  font: 600 10px var(--font-ui);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.account {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
}

.account-id {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 600 14px var(--font-ui);
}

.head {
  width: 32px;
  height: 32px;
  border-radius: 2px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .2);
  image-rendering: pixelated;
}

.btn-outline {
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 4px;
  background: transparent;
  color: rgba(255, 255, 255, .8);
  font: 500 14px var(--font-ui);
  cursor: pointer;
}

.btn-outline:hover { background: rgba(255, 255, 255, .08); color: var(--text); }

/* Son « serveur prêt » activé / coupé */
.btn-sound {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 4px;
  background: transparent;
  color: rgba(255, 255, 255, .85);
  cursor: pointer;
}

.btn-sound:hover { background: rgba(255, 255, 255, .08); color: var(--text); }
.btn-sound:focus-visible { outline: 2px solid var(--sprout); outline-offset: 3px; }
.btn-sound svg { width: 18px; height: 18px; fill: currentColor; }
.btn-sound .icon-off, .btn-sound.is-off .icon-on { display: none; }
.btn-sound.is-off .icon-off { display: block; }
.btn-sound.is-off { color: rgba(255, 255, 255, .5); }

.offline-banner {
  position: sticky;
  top: 72px;
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 28px;
  border-bottom: 1px solid rgba(255, 140, 140, .4);
  background: rgba(120, 20, 30, .72);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font: 500 14px var(--font-ui);
}

.offline-square { flex: none; width: 10px; height: 10px; background: var(--redstone); }
.grow { flex: 1; }

.offline-banner button {
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 4px;
  background: rgba(255, 255, 255, .16);
  color: var(--text);
  font: 600 13px var(--font-ui);
  cursor: pointer;
}

.bottom-tabs { display: none; }

/* ---------- Tableau de bord ---------- */

.dashboard {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: min(760px, 100% - 32px);
  margin: 0 auto;
  padding: 32px 0;
  transition: opacity .2s;
}

.is-offline .dashboard { opacity: .5; pointer-events: none; }

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  backdrop-filter: blur(18px) saturate(1.3);
}

.card-title { margin: 0; font: 600 14px var(--font-ui); color: var(--text-label); }

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.card-link {
  margin-top: auto;
  color: var(--sprout);
  font: 600 14px var(--font-ui);
  text-decoration: none;
}

.card-link.is-soon { color: rgba(255, 255, 255, .45); }
.map-foot .card-link { margin-top: 0; }

.skeleton { border-radius: 4px; background: rgba(255, 255, 255, .08); }
.muted { margin: 0; font: 400 14px/1.5 var(--font-ui); color: rgba(255, 255, 255, .75); }

/* Carte d'état */
.card--state {
  gap: 14px;
  min-height: 300px;
  padding: 36px;
  box-shadow: 0 20px 50px rgba(0, 0, 15, .45);
}

.loading-line {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 500 14px var(--font-ui);
  color: var(--text-muted);
}

.state-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 600 12px var(--font-ui);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .72);
}

.state-dot {
  width: 10px;
  height: 10px;
  background: var(--dot, #8A90A8);
  box-shadow: var(--glow, none);
}

.state-title {
  margin: 0;
  font: 700 36px/1.15 var(--font-ui);
  letter-spacing: -.01em;
  text-wrap: pretty;
}

.state-sub {
  margin: 0;
  font: 400 16px/1.5 var(--font-ui);
  color: var(--text-muted);
  text-wrap: pretty;
}

.progress-wrap { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }

.progress {
  display: flex;
  gap: 3px;
  padding: 4px;
  border-radius: 4px;
  background: var(--slot-bg);
  box-shadow: var(--slot-bevel);
}

.progress span { flex: 1; height: 14px; background: rgba(255, 255, 255, .08); }
.progress span.on { background: var(--sprout); }
.progress-text { font: 500 13px var(--font-ui); color: rgba(255, 255, 255, .75); }

.state-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding-top: 12px;
}

.btn-large { height: 56px; padding: 0 28px; font-size: 16px; }

.btn-busy {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 28px;
  border: 0;
  border-radius: 4px;
  background: #2B5A24;
  color: rgba(255, 255, 255, .85);
  font: 700 16px var(--font-ui);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, .1), inset 0 -4px 0 rgba(0, 0, 0, .3);
  cursor: not-allowed;
}

/* Bouton gris en relief (Redémarrer, Copier, Annuler…) */
.btn-block {
  height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 4px;
  background: rgba(255, 255, 255, .12);
  color: var(--text);
  font: 600 15px var(--font-ui);
  white-space: nowrap;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .12), inset 0 -3px 0 rgba(0, 0, 0, .35);
  cursor: pointer;
}

.btn-block:hover { background: rgba(255, 255, 255, .2); }
.btn-small { height: 44px; padding: 0 18px; font-size: 14px; }

.btn-danger-outline {
  height: 48px;
  padding: 0 20px;
  border: 2px solid rgba(229, 72, 77, .75);
  border-radius: 4px;
  background: transparent;
  color: #FFB3B5;
  font: 600 15px var(--font-ui);
  cursor: pointer;
}

.btn-danger-outline:hover { background: rgba(229, 72, 77, .14); }

.btn-danger {
  height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 4px;
  background: #C9383D;
  color: var(--text);
  font: 600 14px var(--font-ui);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .18), inset 0 -3px 0 rgba(0, 0, 0, .3);
  cursor: pointer;
}

.btn-danger:hover { background: #E5484D; }

.btn-block:focus-visible,
.btn-danger:focus-visible,
.btn-danger-outline:focus-visible,
.btn-outline:focus-visible,
.offline-banner button:focus-visible,
.tab:focus-visible,
.brand--small:focus-visible {
  outline: 2px solid var(--sprout);
  outline-offset: 3px;
}

.confirm {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid rgba(229, 72, 77, .55);
  border-radius: 8px;
  background: rgba(229, 72, 77, .14);
}

.confirm-title { font: 600 15px var(--font-ui); }
.confirm-note { font: 400 14px/1.5 var(--font-ui); color: rgba(255, 255, 255, .85); }
.confirm-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.action-error { margin: 0; color: #FFC4C4; font: 500 13.5px var(--font-ui); }

/* Adresse */
.address-row { display: flex; gap: 8px; }

.address {
  display: flex;
  flex: 1;
  align-items: center;
  min-width: 0;
  height: 48px;
  padding: 0 14px;
  overflow: hidden;
  font: 600 17px ui-monospace, Menlo, Consolas, monospace;
  letter-spacing: .02em;
  white-space: nowrap;
  user-select: all;
}

.btn-copy { padding: 0 16px; font-size: 14px; }
.btn-copy.is-done { background: var(--grass); }

.hint { margin: 0; font: 400 13.5px/1.5 var(--font-ui); color: rgba(255, 255, 255, .78); }
.hint b { color: var(--text); font-weight: 600; }

/* Joueurs */
.count { font: 700 22px var(--font-ui); }
.count small { font: 500 14px var(--font-ui); color: rgba(255, 255, 255, .7); }

.players {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.players li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, .3);
  font: 500 15px var(--font-ui);
}

.players img { width: 32px; height: 32px; border-radius: 2px; image-rendering: pixelated; }

/* Map actuelle */
.card--map { min-height: 300px; }

.map-thumb {
  position: relative;
  flex: 1;
  min-height: 130px;
  overflow: hidden;
  border-radius: 4px;
  background: #9FD3F0;
}

.map-thumb canvas,
.map-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 78% 45%;
  image-rendering: pixelated;
}

.map-thumb img { object-position: center; }

.map-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: var(--slot-bevel);
  pointer-events: none;
}

.map-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.map-name { font: 600 16px var(--font-ui); overflow-wrap: anywhere; }
.big-value { font: 700 22px var(--font-ui); }

/* ---------- Page Maps ---------- */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 0 4px 4px;
}

.page-title {
  margin: 0;
  font: 700 28px/1.2 var(--font-ui);
  text-shadow: 0 2px 12px rgba(0, 0, 20, .6);
}

.page-sub {
  margin: 6px 0 0;
  font: 400 15px/1.4 var(--font-ui);
  color: rgba(255, 255, 255, .85);
  text-shadow: 0 1px 8px rgba(0, 0, 20, .7);
}

.btn-head { flex: none; height: 48px; padding: 0 20px; }
.btn-medium { height: 44px; padding: 0 18px; font-size: 14px; }
.btn-primary:disabled:not(.login .btn-primary) { opacity: .5; cursor: not-allowed; filter: none; transform: none; }
.btn-block:disabled { opacity: .45; cursor: not-allowed; }
.btn-block:disabled:hover { background: rgba(255, 255, 255, .12); }

.card--panel { gap: 16px; }
.card-heading { font: 700 18px/1.3 var(--font-ui); }
.card-sub { margin: 4px 0 0; font: 400 14px/1.4 var(--font-ui); color: var(--text-muted); }

.card-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.btn-quiet {
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 4px;
  background: rgba(255, 255, 255, .1);
  color: var(--text);
  font: 600 13px var(--font-ui);
  cursor: pointer;
}

.btn-quiet:hover { background: rgba(255, 255, 255, .18); }

.alert {
  display: flex;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(255, 140, 140, .45);
  border-radius: 4px;
  background: rgba(120, 20, 30, .55);
}

.alert-square { flex: none; width: 10px; height: 10px; margin-top: 6px; background: var(--redstone); }
.alert-body { display: flex; flex: 1; flex-direction: column; gap: 6px; }
.alert-title { font: 700 15px/1.3 var(--font-ui); }
.alert-text { font: 400 14px/1.5 var(--font-ui); color: rgba(255, 255, 255, .88); text-wrap: pretty; }
.alert-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 190px;
  padding: 20px;
  border: 2px dashed rgba(255, 255, 255, .25);
  border-radius: 4px;
  background: rgba(0, 0, 0, .4);
  box-shadow: inset 2px 2px 0 rgba(0, 0, 0, .5), inset -2px -2px 0 rgba(255, 255, 255, .08);
  text-align: center;
  transition: background .15s, border-color .15s;
}

.dropzone.is-over { border-color: var(--sprout); background: rgba(60, 138, 46, .25); }
.dropzone-text { font: 600 17px var(--font-ui); }
.dropzone-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.dropzone-buttons .btn-block { height: 40px; padding: 0 16px; }
.dropzone-hint { font: 400 13px var(--font-ui); color: rgba(255, 255, 255, .7); }

.file-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.file-name { flex: 1; min-width: 0; overflow: hidden; font: 600 14px var(--font-ui); text-overflow: ellipsis; white-space: nowrap; }
.file-size { font: 500 13px var(--font-ui); color: rgba(255, 255, 255, .75); }

.card--panel .progress span { height: 10px; }
.card--panel .progress-text { color: rgba(255, 255, 255, .8); }

.steps { display: flex; flex-direction: column; gap: 6px; }

.step {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 4px;
  background: rgba(0, 0, 0, .3);
  color: rgba(255, 255, 255, .55);
}

.step.is-done, .step.is-now { color: var(--text); }

.step-box {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 2px;
  background: var(--slot-bg);
  box-shadow: var(--slot-bevel);
  color: #fff;
  font: 700 13px var(--font-ui);
}

.step.is-done .step-box {
  background: var(--grass);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .2), inset 0 -2px 0 rgba(0, 0, 0, .3);
}

.step.is-now .step-box { box-shadow: inset 0 0 0 2px #FFB53A; }
.step-label { flex: 1; font: 500 14px var(--font-ui); }
.step.is-now .step-label { font-weight: 600; }

.step-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 500 13px var(--font-ui);
  color: rgba(255, 255, 255, .75);
}

.step .dots { gap: 3px; }
.step .dots span { width: 5px; height: 5px; background: #FFB53A; }

.success {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid rgba(126, 217, 87, .5);
  border-radius: 4px;
  background: rgba(60, 138, 46, .3);
  font: 500 14px/1.4 var(--font-ui);
}

.success-square { flex: none; width: 10px; height: 10px; background: var(--sprout); box-shadow: 0 0 10px var(--sprout); }

.card--empty { align-items: center; gap: 14px; padding: 56px 24px; text-align: center; }
.empty-slot { width: 72px; height: 72px; }
.empty-title { margin: 0; font: 700 20px/1.3 var(--font-ui); }
.empty-text { max-width: 420px; margin: 0; font: 400 15px/1.5 var(--font-ui); color: var(--text-muted); }
.card--empty .btn-large { margin-top: 8px; height: 52px; padding: 0 24px; }

.load-error { margin: 0; padding: 16px 24px; font: 500 14px/1.5 var(--font-ui); color: rgba(255, 255, 255, .85); }

.worlds {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.world { flex-direction: row; align-items: stretch; gap: 16px; padding: 16px; }
.world.is-current { border-color: rgba(126, 217, 87, .55); }

.world-thumb-slot {
  position: relative;
  flex: none;
  width: 104px;
  height: 104px;
  overflow: hidden;
  border-radius: 4px;
  background: #9FD3F0;
}

.world-thumb-slot::after {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: var(--slot-bevel);
  pointer-events: none;
}

.world-thumb { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.world-body { display: flex; flex: 1; flex-direction: column; gap: 4px; min-width: 0; }
.world-name { margin: 0; font: 600 16px/1.3 var(--font-ui); overflow-wrap: anywhere; }
.world-meta { font: 400 13px/1.4 var(--font-ui); color: rgba(255, 255, 255, .75); }
.world-action { margin-top: auto; padding-top: 10px; }
.btn-play { height: 40px; padding: 0 14px; font-size: 14px; }

.badge-current {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(126, 217, 87, .5);
  border-radius: 4px;
  background: rgba(126, 217, 87, .14);
  color: #C4F2AE;
  font: 600 13px var(--font-ui);
}

.badge-square { width: 8px; height: 8px; background: var(--sprout); box-shadow: 0 0 8px var(--sprout); }

/* Mode de jeu : trois boutons collés dans un emplacement creusé, celui choisi en relief */
.mode-picker {
  display: flex;
  width: 100%;
  max-width: 300px;
  margin-top: 8px;
  padding: 3px;
  gap: 3px;
  border-radius: 4px;
  background: var(--slot-bg);
  box-shadow: var(--slot-bevel);
}

.mode-option {
  flex: 1;
  min-width: 0;
  height: 30px;
  padding: 0 6px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: rgba(255, 255, 255, .75);
  font: 600 12px var(--font-ui);
  white-space: nowrap;
  cursor: pointer;
}

.mode-option:hover { background: rgba(255, 255, 255, .1); color: var(--text); }
.mode-option.is-on {
  background: var(--grass);
  color: var(--text);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .18), inset 0 -3px 0 rgba(0, 0, 0, .3);
  cursor: default;
}
.mode-option:disabled { cursor: not-allowed; }
.mode-option:disabled:not(.is-on) { opacity: .45; }
.mode-option:disabled:not(.is-on):hover { background: transparent; color: rgba(255, 255, 255, .75); }
.mode-option:focus-visible { outline: 2px solid var(--sprout); outline-offset: 2px; }
.world-body > .world-deleting { height: 36px; margin-top: 8px; }

.import-mode { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.import-mode-label { font: 600 14px var(--font-ui); color: var(--text-label); }
.import-mode .mode-picker { margin-top: 0; }

/* Version du serveur (page Maps) */
.version-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 24px; }
.version-now { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.version-big { font: 700 22px var(--font-ui); }
.version-sub { margin: 0; font: 400 13.5px/1.45 var(--font-ui); color: var(--text-muted); }
.version-note { margin: 0; font: 400 12.5px/1.45 var(--font-ui); color: rgba(255, 255, 255, .6); }
.version-change { display: flex; flex: 1 1 300px; gap: 10px; min-width: 0; max-width: 440px; }
.version-change .btn-block { flex: none; }

.version-select {
  flex: 1;
  width: 0; /* sinon la plus longue option impose sa largeur */
  min-width: 0;
  height: 44px;
  padding: 0 34px 0 12px;
  border: 0;
  color: var(--text);
  font: 500 14px var(--font-ui);
  text-overflow: ellipsis;
  appearance: none;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, #fff 50%), linear-gradient(135deg, #fff 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

.version-select option { background: #0B1330; color: var(--text); }
.version-select option:disabled { color: rgba(255, 255, 255, .45); }
.version-select:disabled { opacity: .5; cursor: not-allowed; }
.version-select:focus-visible { outline: 2px solid var(--sprout); outline-offset: 2px; }

.world-warning { margin: 6px 0 0; font: 500 12.5px/1.4 var(--font-ui); color: #FFD08A; }

/* Carte du monde (tableau de bord) : interrupteur façon case d'inventaire, bloc qui glisse */
.card--wide { grid-column: 1 / -1; }
.card-head--switch { align-items: center; }
.switch-text { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

.switch {
  position: relative;
  flex: none;
  width: 64px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: var(--slot-bg);
  box-shadow: var(--slot-bevel);
  cursor: pointer;
  transition: background .15s;
}

.switch::after {
  content: '';
  position: absolute;
  top: 6px;
  left: 6px;
  width: 22px;
  height: 22px;
  border-radius: 3px;
  background: #A9AEBF;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .35), inset 0 -3px 0 rgba(0, 0, 0, .3);
  transition: transform .15s, background .15s;
}

.switch[aria-checked="true"] { background: var(--grass); }
.switch[aria-checked="true"]::after { background: #fff; transform: translateX(30px); }
.switch:disabled { opacity: .5; cursor: not-allowed; }
.switch.is-pending { cursor: progress; }
.switch:focus-visible { outline: 2px solid var(--sprout); outline-offset: 3px; }

/* Mode de jeu à côté du nom de la map (tableau de bord) */
.map-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; min-width: 0; }
.mode-chip {
  padding: 3px 8px;
  border: 1px solid rgba(126, 217, 87, .5);
  border-radius: 4px;
  background: rgba(126, 217, 87, .14);
  color: #C4F2AE;
  font: 600 12px var(--font-ui);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 12, .55);
}

.modal {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 480px;
  max-width: 100%;
  padding: 28px;
  border: 1px solid rgba(170, 190, 255, .3);
  border-radius: 18px;
  background: rgba(8, 12, 32, .82);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  backdrop-filter: blur(18px) saturate(1.3);
  box-shadow: 0 24px 60px rgba(0, 0, 15, .6);
}

.modal-title { margin: 0; font: 700 20px/1.3 var(--font-ui); text-wrap: pretty; }
.modal-text { margin: 0; font: 400 15px/1.55 var(--font-ui); color: rgba(255, 255, 255, .88); text-wrap: pretty; }
.modal-actions { display: flex; gap: 10px; margin-top: 10px; }
.btn-modal { height: 52px; padding: 0 22px; }
.btn-modal-cancel { height: 52px; padding: 0 20px; }

.btn-quiet:focus-visible,
.btn-primary:focus-visible { outline: 2px solid var(--sprout); outline-offset: 3px; }

/* ---------- Page Sauvegardes ---------- */

.page-count {
  margin: 6px 0 0;
  font: 400 15px/1.4 var(--font-ui);
  color: rgba(255, 255, 255, .85);
  text-shadow: 0 1px 8px rgba(0, 0, 20, .7);
}

.btn-save { flex: none; height: 52px; padding: 0 22px; }

.progress-text { display: flex; align-items: center; gap: 8px; }
.progress-text .dots { gap: 3px; }
.progress-text .dots span { width: 5px; height: 5px; background: #FFB53A; }

/* Bandeaux : limite atteinte (ambre), opération terminée (vert), erreur (rouge) */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid rgba(255, 181, 58, .5);
  border-radius: 18px;
  background: rgba(90, 60, 10, .6);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.notice-square { flex: none; width: 10px; height: 10px; margin-top: 6px; background: #FFB53A; }
.notice-body { display: flex; flex: 1; flex-direction: column; gap: 4px; }
.notice-title { font: 700 15px/1.3 var(--font-ui); }
.notice-text { font: 400 14px/1.5 var(--font-ui); color: rgba(255, 255, 255, .88); }

.notice--done {
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-color: rgba(126, 217, 87, .5);
  background: rgba(30, 70, 24, .65);
}

.notice--done .notice-square { margin-top: 0; background: var(--sprout); box-shadow: 0 0 10px var(--sprout); }
.notice--done .notice-text { font-weight: 500; color: var(--text); }
.notice--error { border-color: rgba(255, 140, 140, .45); background: rgba(120, 20, 30, .6); }
.notice--error .notice-square { background: var(--redstone); }

.backups { gap: 0; padding: 8px; }

.backup-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px auto;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border-radius: 10px;
}

.backup-row:hover { background: rgba(255, 255, 255, .05); }
.backup-row.is-restoring { background: rgba(255, 181, 58, .12); }
.backup-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.backup-when { font: 600 15px/1.3 var(--font-ui); }
.backup-meta { font: 400 13px/1.4 var(--font-ui); color: rgba(255, 255, 255, .75); overflow-wrap: anywhere; }
.backup-actions { display: flex; gap: 8px; }

.badge-type {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 9px;
  border-radius: 4px;
  font: 600 12px var(--font-ui);
}

.badge-type.is-auto { border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .08); color: rgba(255, 255, 255, .85); }
.badge-type.is-manual { border: 1px solid rgba(126, 217, 87, .45); background: rgba(126, 217, 87, .14); color: #C4F2AE; }

.btn-row { height: 40px; padding: 0 14px; font-size: 14px; }

.btn-link-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 4px;
  color: var(--text);
  font: 600 14px var(--font-ui);
  text-decoration: none;
  white-space: nowrap;
}

.btn-link-outline:hover { background: rgba(255, 255, 255, .08); }

/* Bouton corbeille (supprimer une map ou une sauvegarde) */
.btn-icon-danger {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid rgba(229, 72, 77, .45);
  border-radius: 4px;
  background: transparent;
  color: #FFB3B5;
  cursor: pointer;
}

.btn-icon-danger:hover { background: rgba(229, 72, 77, .14); }
.btn-icon-danger:disabled { opacity: .45; cursor: not-allowed; }
.btn-icon-danger:disabled:hover { background: transparent; }
.btn-icon-danger:focus-visible { outline: 2px solid var(--sprout); outline-offset: 3px; }
.btn-icon-danger svg { width: 18px; height: 18px; fill: currentColor; }
.btn-icon-danger .dots span { width: 4px; height: 4px; background: #FFB3B5; }

.world-action { display: flex; align-items: center; gap: 8px; }
.world-deleting { display: inline-flex; align-items: center; gap: 8px; height: 40px; font: 500 13px var(--font-ui); color: rgba(255, 255, 255, .75); }
.world-deleting .dots span { width: 5px; height: 5px; background: #FFB53A; }
.btn-link-outline:focus-visible { outline: 2px solid var(--sprout); outline-offset: 3px; }

/* Confirmation de restauration (rouge) */
.modal--danger { width: 500px; border-color: rgba(255, 120, 120, .5); background: rgba(40, 8, 14, .86); }
.modal-title-row { display: flex; align-items: center; gap: 12px; }
.danger-square { flex: none; width: 12px; height: 12px; background: var(--redstone); box-shadow: 0 0 12px var(--redstone); }
.modal--danger .modal-text { color: rgba(255, 255, 255, .9); }

.modal-loss {
  margin: 0;
  padding: 12px 14px;
  border-radius: 4px;
  background: rgba(0, 0, 0, .35);
  color: #FFC9CB;
  font: 500 14px/1.5 var(--font-ui);
}

.btn-danger-big {
  padding: 0 22px;
  font: 700 15px var(--font-ui);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, .2), inset 0 -4px 0 rgba(0, 0, 0, .3), 0 4px 0 #7A1D21;
}

.btn-danger-big:active { transform: translateY(2px); }

/* ---------- Petits écrans ---------- */

@media (max-width: 600px) {
  .stage { justify-content: center; padding: 16px; }
  .panel { padding: 36px 24px 28px; }
  .login { min-height: 0; }
}

/* Tableau de bord sur téléphone (maquette 1d) : onglets en bas */
@media (max-width: 700px) {
  .topbar { justify-content: space-between; gap: 12px; height: 60px; padding: 0 18px; }
  .brand--small { font-size: 14px; }
  .topbar .tabs, .account-name { display: none; }
  .account { gap: 10px; }
  .head { width: 28px; height: 28px; box-shadow: none; }
  .topbar .btn-outline { padding: 10px 4px; border: 0; font-size: 13px; }
  .btn-sound { width: 44px; height: 44px; border: 0; }

  .offline-banner { top: 60px; gap: 10px; padding: 10px 16px; font-size: 13px; }
  .offline-banner button { height: 44px; padding: 0 12px; }
  .offline-square { display: none; }

  .dashboard {
    gap: 14px;
    width: 100%;
    padding: 16px 16px calc(88px + env(safe-area-inset-bottom));
  }

  .dash-grid { grid-template-columns: 1fr; gap: 14px; }
  .card--state { min-height: 0; padding: 24px; }
  .state-title { font-size: 28px; }
  .card--map { min-height: 250px; }

  /* Maps sur téléphone (maquette 2b) */
  .page-head { align-items: center; padding: 0 2px; }
  .page-title { font-size: 24px; }
  .page-sub { display: none; }
  .btn-head { height: 44px; padding: 0 16px; font-size: 14px; }
  .card--panel { gap: 14px; padding: 18px; }
  .card-heading { font-size: 16px; }
  .btn-quiet { height: 44px; }
  .dropzone { min-height: 0; padding: 24px 16px; }
  .dropzone-text { font-size: 15px; }
  .dropzone-buttons .btn-block { height: 48px; }
  .step { gap: 10px; padding: 0 10px; }
  .step-box { width: 20px; height: 20px; font-size: 12px; }
  .step-label { font-size: 13px; }
  .step-status { gap: 6px; font-size: 12px; }
  .worlds { grid-template-columns: 1fr; gap: 14px; }
  .world { gap: 12px; padding: 12px; }
  .world-thumb-slot { width: 84px; height: 84px; }
  .world-name { font-size: 15px; }
  .world-meta { font-size: 12px; }
  .world-action { padding-top: 8px; }
  .badge-current { height: 32px; padding: 0 10px; font-size: 12px; }
  .btn-play { height: 44px; padding: 0 12px; font-size: 13px; }
  .mode-picker { max-width: none; }
  .version-change { flex-basis: 100%; max-width: none; }
  .version-select { height: 48px; }
  .version-big { font-size: 20px; }
  .mode-option { height: 36px; padding: 0 4px; }
  .card--empty { padding: 40px 20px; }
  .empty-slot { width: 60px; height: 60px; }
  .empty-title { font-size: 18px; }
  .empty-text { font-size: 14px; }
  .card--empty .btn-large { align-self: stretch; }

  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal {
    width: 100%;
    padding: 24px 20px calc(32px + env(safe-area-inset-bottom));
    border-width: 1px 0 0;
    border-radius: 22px 22px 0 0;
    background: rgba(8, 12, 32, .9);
  }
  .modal-title { font-size: 18px; }
  .modal-text { font-size: 14px; }
  .modal-actions { flex-direction: column; margin-top: 8px; }
  .btn-modal-cancel { height: 48px; }

  /* Sauvegardes sur téléphone (maquette 3b) : bouton sous le titre, une carte par sauvegarde */
  .page-head--stack { flex-direction: column; align-items: stretch; gap: 14px; }
  .page-count { margin-top: 4px; font-size: 13px; }
  .btn-save { height: auto; min-height: 52px; padding: 8px 16px; }
  .notice { gap: 10px; padding: 14px; border-radius: 14px; }
  .notice-title { font-size: 14px; }
  .notice-text { font-size: 13px; }
  .notice--done .btn-quiet, .notice--error .btn-quiet { height: 44px; }

  .backups { gap: 14px; padding: 0; border: 0; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .backup-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "info type" "actions actions";
    align-items: start;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    background: var(--glass);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
  }
  .backup-row:hover { background: var(--glass); }
  .backup-row.is-restoring { background: rgba(90, 60, 10, .6); }
  .backup-info { grid-area: info; gap: 2px; }
  .backup-type { grid-area: type; }
  .backup-actions { grid-area: actions; display: grid; grid-template-columns: 1fr 1fr auto; }
  .btn-icon-danger { width: 44px; height: 44px; }
  .backup-meta { font-size: 12px; }
  .badge-type { height: 24px; padding: 0 8px; font-size: 11px; }
  .btn-row, .btn-link-outline { height: 44px; }
  .modal--danger { width: 100%; background: rgba(40, 8, 14, .92); }
  .btn-danger-big { font-size: 16px; }

  .bottom-tabs {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    height: calc(72px + env(safe-area-inset-bottom));
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--glass-border);
    background: rgba(8, 12, 32, .78);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
  }

  .bottom-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: rgba(255, 255, 255, .75);
    font: 500 12px var(--font-ui);
    text-align: center;
    text-decoration: none;
  }

  .bottom-tab::before { content: ''; width: 22px; height: 4px; }
  .bottom-tab[aria-current="page"] { color: var(--text); font-weight: 600; }
  .bottom-tab[aria-current="page"]::before { background: var(--sprout); box-shadow: 0 0 8px var(--sprout); }
  .bottom-tab.is-soon { gap: 4px; color: rgba(255, 255, 255, .4); }
  .bottom-tab small { font-size: 10px; letter-spacing: .04em; text-transform: uppercase; }
}

@media (max-height: 600px) {
  .login { min-height: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .dots span { animation: none; opacity: .8; }
  .input, .btn-primary { transition: none; }
}
