@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

:root {
  color-scheme: dark;

  --bg: #07070a;
  --text: #f4f2ec;
  --muted: rgba(244, 242, 236, 0.62);
  --faint: rgba(244, 242, 236, 0.4);
  --line: rgba(244, 242, 236, 0.14);
  --line-strong: rgba(244, 242, 236, 0.34);
  --panel: rgba(13, 13, 17, 0.72);

  --red: #ff4b3e;
  --blue: #5a9bff;
  --gold: #e8bd76;
  --danger: #ffb45c;

  --font: "Archivo", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --radius: 4px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}

#view {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

#view.is-pointer { cursor: pointer; }

svg { display: block; width: 20px; height: 20px; flex: none; }

/* Boutons */

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 20px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(7, 7, 10, 0.5);
  color: var(--text);
  font: 600 15px/1 var(--font);
  cursor: pointer;
  transition: background 160ms, border-color 160ms, color 160ms, transform 160ms var(--ease-out), opacity 160ms;
}

.btn:hover:not(:disabled) { background: rgba(244, 242, 236, 0.12); border-color: var(--text); }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.35; cursor: default; }

.btn-primary { background: var(--text); border-color: var(--text); color: #0a0a0d; }
.btn-primary:hover:not(:disabled) { background: #fff; border-color: #fff; }

.btn-danger { background: #5e1410; border-color: var(--red); }
.btn-wide { width: 100%; }

.btn-icon { width: 46px; padding: 0; }
.btn-icon .btn-label:empty { display: none; }
.btn-icon.is-armed { width: auto; padding: 0 14px; background: #5e1410; border-color: var(--red); }

.link {
  appearance: none;
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: 500 13px/1.3 var(--font);
  text-decoration: none;
  cursor: pointer;
  transition: color 160ms;
}

.link:hover { color: var(--text); }

button:focus-visible, a:focus-visible, input:focus-visible + span, input:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* Accueil */

.menu {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: calc(26px + var(--safe-top)) 5vw calc(26px + var(--safe-bottom));
  background: linear-gradient(90deg, rgba(7, 7, 10, 0.94), rgba(7, 7, 10, 0.68) 34%, rgba(7, 7, 10, 0) 58%);
  transition: opacity 420ms, transform 620ms var(--ease-out);
  overflow-y: auto;
}

.menu.is-leaving { opacity: 0; transform: translateX(-28px); pointer-events: none; }

.menu-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0;
  font-size: clamp(30px, 3.2vw, 44px);
  font-weight: 800;
  font-stretch: 125%;
  line-height: 1;
  letter-spacing: 0.015em;
  text-transform: uppercase;
}

.logo-mark { width: 0.92em; height: 0.92em; }

.account-chip {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(7, 7, 10, 0.56);
  color: var(--text);
  font: 600 14px var(--font);
  cursor: pointer;
  transition: border-color 160ms;
}

.account-chip:hover { border-color: var(--text); }
.account-chip strong { font-weight: 700; font-variant-numeric: tabular-nums; }
.account-chip small { color: var(--muted); font-size: 12px; font-weight: 500; }

.menu-column {
  width: min(430px, 100%);
  margin: auto 0;
  padding: 24px 0;
}

.panel { animation: panelIn 420ms var(--ease-out) both; }

.tagline {
  margin: 0 0 26px;
  font-size: clamp(24px, 2.6vw, 34px);
  font-weight: 700;
  font-stretch: 100%;
  line-height: 1.12;
  letter-spacing: -0.012em;
}

.nav {
  display: grid;
  border-top: 1px solid var(--line);
}

.nav-item {
  appearance: none;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: 12px;
  padding: 15px 2px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  color: var(--text);
  font-family: var(--font);
  text-align: left;
  cursor: pointer;
  transition: padding 240ms var(--ease-out), color 160ms;
}

.nav-title { font-size: 19px; font-weight: 700; line-height: 1.2; }
.nav-sub { grid-row: 2; color: var(--muted); font-size: 13px; font-weight: 400; }
.nav-item svg { grid-row: 1 / 3; grid-column: 2; color: var(--faint); transition: transform 240ms var(--ease-out), color 160ms; }
.nav-item:hover, .nav-item:focus-visible { padding-left: 12px; }
.nav-item:hover svg { color: var(--text); transform: translateX(4px); }
.nav-item:active { color: var(--muted); }

.nav-item.is-primary {
  margin-bottom: -1px;
  padding: 16px 16px;
  border-bottom: 0;
  border-radius: var(--radius);
  background: var(--text);
  color: #0a0a0d;
}

.nav-item.is-primary .nav-sub { color: rgba(10, 10, 13, 0.62); }
.nav-item.is-primary svg { color: #0a0a0d; }
.nav-item.is-primary:hover { padding-left: 22px; background: #fff; }

.menu-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-top: 20px;
}

.menu-error {
  margin: 0 0 14px;
  color: #ffc9a8;
  font-size: 14px;
}

.back {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin: 0 0 12px -6px;
  padding: 4px 8px 4px 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: 500 14px var(--font);
  cursor: pointer;
}

.back:hover { color: var(--text); }

.panel h2 {
  margin: 0 0 18px;
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.012em;
}

.choice { border: 0; padding: 0; margin: 0 0 16px; }

.choice legend {
  padding: 0;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.field-note { margin: 6px 0 0; color: var(--faint); font-size: 12px; }

.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 1px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--line);
  overflow: hidden;
}

.segmented label { display: block; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }

.segmented span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  background: rgba(7, 7, 10, 0.86);
  font-size: 14px;
  font-weight: 600;
  transition: background 150ms, color 150ms;
}

.segmented label:hover span { background: rgba(38, 38, 44, 0.9); }
.segmented input:checked + span { background: var(--text); color: #0a0a0d; }

.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot[data-player="0"] { background: var(--red); }
.dot[data-player="1"] { background: var(--blue); }

.menu-actions { display: grid; gap: 8px; margin-top: 22px; }

.panel-status { margin: 0 0 16px; min-height: 21px; color: var(--muted); }
.waiting-line { margin: 16px 0 0; }

.searching { display: flex; gap: 8px; margin-bottom: 14px; }

.searching i {
  width: 14px;
  height: 14px;
  background: var(--text);
  animation: searching 1.2s var(--ease-out) infinite;
}

.searching i:nth-child(1) { background: var(--red); }
.searching i:nth-child(2) { animation-delay: 120ms; }
.searching i:nth-child(3) { background: var(--blue); animation-delay: 240ms; }

.invite-link {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.55);
  color: var(--text);
  font: 13px var(--mono);
}

/* Interface de jeu */

.hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  animation: fadeIn 600ms 300ms both;
}

.hud button { pointer-events: auto; }
.hud > * { transition: opacity 400ms; }
.hud.is-muted > * { opacity: 0; pointer-events: none; }
.hud.is-muted button { pointer-events: none; }

/* Le rapport de force, tout en haut */

.territory {
  position: absolute;
  top: calc(16px + var(--safe-top));
  left: 50%;
  width: min(460px, 42vw);
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: 26px 1fr 26px;
  align-items: center;
  gap: 8px;
}

.territory-count {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

#countRed { color: var(--red); text-align: right; }
#countBlue { color: var(--blue); }

.territory-bar {
  display: flex;
  gap: 2px;
  height: 6px;
  overflow: hidden;
}

.territory-bar span {
  flex: 0 0 auto;
  width: 0;
  transition: width 520ms var(--ease-out);
}

.territory-bar [data-color="red"] { background: var(--red); }
.territory-bar [data-color="blue"] { background: var(--blue); }
.territory-bar [data-color="black"] { background: rgba(244, 242, 236, 0.16); }

.turn {
  position: absolute;
  top: calc(40px + var(--safe-top));
  left: 50%;
  width: min(620px, calc(100vw - 32px));
  transform: translateX(-50%);
  text-align: center;
}

.turn-main {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.012em;
  text-shadow: 0 2px 22px rgba(0, 0, 0, 0.9);
}

.turn-main.is-changing { animation: statusIn 420ms var(--ease-out) both; }
.turn-main[data-player="0"] { color: var(--red); }
.turn-main[data-player="1"] { color: var(--blue); }

.turn-hint {
  margin: 3px 0 0;
  min-height: 21px;
  color: var(--muted);
  font-size: 14px;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.95);
}

.turn-hint.is-alert { color: var(--danger); font-weight: 600; }

.toast {
  position: absolute;
  top: calc(106px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: var(--radius);
  background: var(--text);
  color: #0a0a0d;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  animation: toastIn 2.4s var(--ease-out) both;
}

.toast[data-player="0"] { background: var(--red); color: #1d0402; }
.toast[data-player="1"] { background: var(--blue); color: #020a1d; }

/* Les joueurs */

.plaque {
  position: absolute;
  top: 50%;
  width: 208px;
  transform: translateY(-50%);
  padding: 14px 16px;
  border-left: 3px solid var(--line);
  opacity: 0.56;
  transition: opacity 320ms, border-color 320ms;
}

.plaque-left { left: 26px; }
.plaque-right { right: 26px; }
.plaque.is-active { opacity: 1; }
.plaque.is-active[data-player="0"] { border-left-color: var(--red); }
.plaque.is-active[data-player="1"] { border-left-color: var(--blue); }

.plaque-color {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.plaque[data-player="0"] .plaque-color { color: var(--red); }
.plaque[data-player="1"] .plaque-color { color: var(--blue); }

.plaque-name {
  overflow: hidden;
  margin-top: 1px;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plaque-role { color: var(--muted); font-size: 13px; }

.plaque-clock {
  margin-top: 10px;
  font-size: 34px;
  font-weight: 700;
  font-stretch: 90%;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.plaque-clock.is-low { color: var(--red); }

.pips {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 14px;
}

.pips i {
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--line-strong);
  transform: rotate(45deg) scale(0.82);
  transition: background 300ms, border-color 300ms;
}

.pips i.is-on { animation: pipOn 620ms var(--ease-out) both; }
.plaque[data-player="0"] .pips i.is-on { background: var(--red); border-color: var(--red); }
.plaque[data-player="1"] .pips i.is-on { background: var(--blue); border-color: var(--blue); }
.pips span { margin-left: 3px; color: var(--muted); font-size: 12px; }

.lives {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.lives i { width: 8px; height: 8px; border-radius: 50%; background: var(--text); margin-right: 1px; }
.lives i.is-gone { background: none; box-shadow: inset 0 0 0 1px var(--line-strong); }
.lives i.is-home { background: var(--gold); }
.lives span { margin-left: 5px; }

.plaque-warn {
  margin-top: 10px;
  color: var(--danger);
  font-size: 12px;
  line-height: 1.35;
}

/* Placement */

.is-placing .plaque,
.is-placing #undoBtn,
.is-placing #resignBtn { display: none !important; }

.placement {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(22px + var(--safe-bottom));
  width: fit-content;
  max-width: calc(100vw - 16px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  animation: panelUp 420ms var(--ease-out) both;
}

.placement-count {
  min-width: 54px;
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.placement-seconds {
  min-width: 34px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.placement-seconds.is-low { color: var(--text); }

.placement-timer {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  overflow: hidden;
  border-radius: var(--radius) var(--radius) 0 0;
  background: rgba(255, 255, 255, 0.07);
}

.placement-timer i {
  display: block;
  height: 100%;
  background: var(--text);
  transform-origin: left;
  transition: transform 220ms linear;
}

.placement-timer.is-low i { background: #f0b429; }
.placement-timer.is-critical i { background: #ff5a47; animation: nudgePulse 600ms ease-in-out infinite; }

.placement.is-nudged #placementRandom { animation: nudgeRing 1.7s ease-out infinite; }

.placement-nudge {
  position: fixed;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.9);
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 22px));
  animation: nudgeIn 320ms var(--ease-out) both;
}

.placement-nudge svg { width: 26px; height: 26px; animation: nudgeBounce 850ms ease-in-out infinite; }

@keyframes nudgeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes nudgeBounce { 0%, 100% { transform: translateY(-3px); } 50% { transform: translateY(5px); } }
@keyframes nudgePulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@keyframes nudgeRing {
  0% { box-shadow: 0 0 0 0 rgba(244, 242, 236, 0.5); }
  70%, 100% { box-shadow: 0 0 0 10px rgba(244, 242, 236, 0); }
}

/* Actions */

.dock {
  position: absolute;
  right: 26px;
  bottom: calc(22px + var(--safe-bottom));
  display: flex;
  gap: 6px;
}

.dock .btn { background: rgba(7, 7, 10, 0.6); border-color: var(--line); color: var(--muted); }
.dock .btn:hover:not(:disabled) { border-color: var(--line-strong); color: var(--text); }
.dock .btn-primary { background: var(--text); border-color: var(--text); color: #0a0a0d; }

.is-tutorial .turn,
.is-tutorial .plaque,
.is-tutorial .territory,
.is-tutorial .dock,
.is-tutorial .toast { display: none !important; }

/* Tutoriel */

.tutorial {
  position: fixed;
  left: 30px;
  top: 50%;
  width: 300px;
  transform: translateY(-50%);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  animation: fadeIn 420ms both;
}

.tutorial-progress {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 3px;
  margin-bottom: 16px;
}

.tutorial-progress i { height: 3px; background: var(--line); transition: background 300ms; }
.tutorial-progress i.is-done { background: var(--text); }

.tutorial h2 {
  margin: 0 0 7px;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.01em;
}

.tutorial p {
  margin: 0;
  color: rgba(244, 242, 236, 0.84);
  line-height: 1.42;
}

.tutorial p.is-done { color: var(--text); font-weight: 600; }

.tutorial-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-top: 16px;
  min-height: 46px;
}

/* Passage du téléphone */

.handoff {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  background: rgba(5, 5, 8, 0.84);
  -webkit-backdrop-filter: blur(22px);
  backdrop-filter: blur(22px);
  animation: fadeIn 300ms both;
}

.handoff-title {
  margin: 0;
  font-size: clamp(38px, 6vw, 72px);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -0.02em;
}

.handoff-title[data-player="0"] { color: var(--red); }
.handoff-title[data-player="1"] { color: var(--blue); }

.handoff-detail {
  max-width: 460px;
  margin: 12px 0 26px;
  color: var(--muted);
  font-size: 17px;
}

/* Fin de partie */

.end {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 24px 20px calc(8vh + var(--safe-bottom));
  text-align: center;
  background: linear-gradient(0deg, rgba(7, 7, 10, 0.96), rgba(7, 7, 10, 0.78) 42%, rgba(7, 7, 10, 0) 76%);
  animation: fadeIn 520ms both;
  overflow-y: auto;
}

.end-title {
  margin: 0;
  font-size: clamp(54px, 10vw, 136px);
  font-weight: 800;
  font-stretch: 112%;
  line-height: 0.96;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  animation: resultIn 900ms var(--ease-out) both;
}

.end-title[data-player="0"] { color: var(--red); }
.end-title[data-player="1"] { color: var(--blue); }

.end-detail {
  margin: 12px 0 18px;
  color: rgba(244, 242, 236, 0.84);
  font-size: 18px;
  animation: riseIn 700ms 150ms var(--ease-out) both;
}

.end-stats {
  display: flex;
  justify-content: center;
  gap: 28px;
  margin-bottom: 20px;
  animation: riseIn 700ms 240ms var(--ease-out) both;
}

.end-stats div { display: grid; gap: 1px; }
.end-stats strong { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.end-stats span { color: var(--muted); font-size: 12px; }

.end-elo {
  margin: 0 0 22px;
  font-size: 22px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  animation: riseIn 700ms 300ms var(--ease-out) both;
}

.end-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  animation: riseIn 700ms 360ms var(--ease-out) both;
}

.end-feedback {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 16px;
  color: var(--faint);
  font-size: 13px;
  animation: fadeIn 700ms 800ms both;
}

.no-webgl {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 18px;
  padding: 24px;
  text-align: center;
}

.no-webgl p { max-width: 460px; margin: 0; color: var(--muted); }

/* Fenêtres */

.dialog {
  width: min(600px, calc(100vw - 24px));
  max-height: min(86vh, 820px);
  padding: 26px 28px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #0f0f14;
  color: var(--text);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.75);
}

.dialog[open] { animation: panelUp 340ms var(--ease-out) both; }
.dialog::backdrop { background: rgba(3, 3, 6, 0.66); }
.dialog-small { width: min(420px, calc(100vw - 24px)); }

.dialog h2 { margin: 0 0 14px; font-size: 28px; font-weight: 800; line-height: 1.1; letter-spacing: -0.012em; }
.dialog h3 { margin: 22px 0 8px; font-size: 13px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.dialog p { margin: 0 0 10px; }
.dialog ul, .dialog ol { margin: 0; padding-left: 20px; }
.dialog li { margin-bottom: 7px; }
.dialog strong { font-weight: 700; }
.rules-goal { font-size: 18px; line-height: 1.35; }

.legend { list-style: none; padding: 0 !important; }
.legend li { display: flex; align-items: center; gap: 10px; }

.chip {
  position: relative;
  flex: none;
  width: 18px;
  height: 18px;
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.chip[data-color="black"] { background: #0a0a0e; }
.chip[data-color="red"] { background: #b5141d; }
.chip[data-color="blue"] { background: #1644c8; }
.chip-locked { box-shadow: inset 0 0 0 2px var(--gold); }

.dialog-actions {
  position: sticky;
  bottom: -26px;
  display: flex;
  justify-content: flex-end;
  margin: 20px -28px -26px;
  padding: 14px 28px 20px;
  background: linear-gradient(0deg, #0f0f14 72%, transparent);
}

.dialog-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-top: 18px;
}

.field {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.field input {
  display: block;
  width: 100%;
  min-height: 46px;
  margin-top: 5px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #000;
  color: var(--text);
  font: 16px var(--font);
}

.account-note { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.account-note a { color: var(--muted); }
.delete-form { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.delete-form p { font-size: 14px; }

.profile-rating { color: var(--muted); }
.profile-rating strong { font-size: 46px; font-weight: 800; line-height: 1; color: var(--text); font-variant-numeric: tabular-nums; }

.leaderboard { list-style: none; margin: 0; padding: 0 !important; }

.leaderboard li {
  display: grid;
  grid-template-columns: 30px 1fr auto auto;
  align-items: baseline;
  gap: 12px;
  margin: 0;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.leaderboard .rank { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.leaderboard .name { overflow: hidden; font-weight: 600; text-overflow: ellipsis; }
.leaderboard .record { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.leaderboard .elo { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* Animations */

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes panelIn { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }
@keyframes panelUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes riseIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes statusIn { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes resultIn { from { opacity: 0; letter-spacing: 0.08em; } to { opacity: 1; letter-spacing: -0.02em; } }
@keyframes pipOn { 0% { transform: rotate(45deg) scale(0.2); } 55% { transform: rotate(45deg) scale(1.2); } 100% { transform: rotate(45deg) scale(0.82); } }
@keyframes searching { 0%, 100% { opacity: 0.25; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1); } }
@keyframes toastIn {
  0% { opacity: 0; transform: translate(-50%, 8px); }
  10% { opacity: 1; transform: translate(-50%, 0); }
  85% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -4px); }
}

/* Fenêtre étroite et téléphone */

@media (max-width: 1040px) {
  .menu {
    padding: calc(16px + var(--safe-top)) 16px calc(14px + var(--safe-bottom));
    background: linear-gradient(0deg, rgba(7, 7, 10, 0.98) 46%, rgba(7, 7, 10, 0.5) 66%, rgba(7, 7, 10, 0) 80%);
  }
  .logo { font-size: 26px; gap: 10px; }
  .account-chip { min-height: 36px; padding: 0 11px; font-size: 13px; }
  .menu-column { width: 100%; max-width: 520px; margin: auto auto 0; padding: 0; }
  .tagline { display: none; }
  .nav-item { padding: 11px 2px; }
  .nav-title { font-size: 17px; }
  .nav-sub { font-size: 12px; }
  .nav-item.is-primary { padding: 12px 14px; }
  .menu-links { justify-content: center; margin-top: 12px; }
  .panel h2 { font-size: 24px; margin-bottom: 12px; }
  .choice { margin-bottom: 11px; }
  .segmented span { min-height: 40px; }
  .field-note { display: none; }
  .menu-actions { margin-top: 14px; }

  .territory {
    top: calc(76px + var(--safe-top));
    left: 12px;
    right: 12px;
    width: auto;
    transform: none;
    grid-template-columns: 22px 1fr 22px;
  }
  .territory-count { font-size: 13px; }

  .turn { top: calc(100px + var(--safe-top)); }
  .turn-main { font-size: 21px; }
  .turn-hint { font-size: 13px; }

  .toast { top: calc(152px + var(--safe-top)); font-size: 13px; }

  .plaque {
    top: calc(10px + var(--safe-top));
    width: calc(50% - 16px);
    transform: none;
    padding: 2px 0 2px 9px;
    display: grid;
    grid-template-columns: 1fr auto;
    column-gap: 6px;
  }
  .plaque-left { left: 12px; }
  .plaque-right { right: 12px; }
  .plaque-color { display: none; }
  .plaque-name { margin: 0; font-size: 14px; }
  .plaque-role { display: none; }
  .plaque-clock { grid-column: 2; grid-row: 1 / 3; margin: 0; font-size: 21px; align-self: center; }
  .pips { grid-column: 1; margin-top: 5px; gap: 5px; }
  .pips i { width: 11px; height: 11px; }
  .pips span { display: none; }
  .lives { grid-column: 1; margin-top: 5px; }
  .lives span { display: none; }
  .lives i { width: 6px; height: 6px; }
  .plaque-warn { display: none; }

  .dock {
    left: 0;
    right: 0;
    bottom: calc(12px + var(--safe-bottom));
    justify-content: center;
  }
  .placement { bottom: calc(68px + var(--safe-bottom)); }

  .tutorial {
    left: 10px;
    right: 10px;
    top: auto;
    bottom: calc(10px + var(--safe-bottom));
    width: auto;
    transform: none;
    padding: 14px 16px;
  }
  .tutorial-progress { margin-bottom: 11px; }
  .tutorial h2 { font-size: 19px; margin-bottom: 4px; }
  .tutorial p { font-size: 14px; }
  .tutorial-actions { margin-top: 10px; min-height: 42px; }
  .tutorial .btn { min-height: 42px; }
  .is-tutorial .placement { bottom: calc(212px + var(--safe-bottom)); }

  .end { padding-bottom: calc(18px + var(--safe-bottom)); }
  .end-detail { font-size: 16px; }
  .end-stats { gap: 20px; }

  .dialog { padding: 20px 18px; }
  .dialog-actions { margin: 16px -18px -20px; padding: 12px 18px 16px; bottom: -20px; }
}

/* Mode tournage : rien que le plateau à l'écran. */
.is-video-mode .menu, .is-video-mode .hud { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important; }
}
