* { margin: 0; padding: 0; box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1a1a2e;
  font-family: system-ui, sans-serif;
}

canvas {
  display: block;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  /* Pointe du curseur ≈ coin haut-gauche du viewBox 24×24 */
  cursor: url('../src/assets/cursor.svg') 5 5, default;
}

/* En partie : pas de sélection / menu tactile parasite */
body:not(.in-menu) {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

body:not(.in-menu) input,
body:not(.in-menu) textarea {
  user-select: text;
  -webkit-user-select: text;
}

    #settings-btn {
      position: fixed;
      top: 16px;
      right: 16px;
      z-index: 10;
      width: 40px;
      height: 40px;
      border: none;
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.08);
      color: rgba(255, 255, 255, 0.7);
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: background 0.15s, color 0.15s;
    }
    #settings-btn:hover {
      background: rgba(255, 255, 255, 0.15);
      color: #fff;
    }
    #settings-btn svg {
      width: 20px;
      height: 20px;
    }

    body.in-menu #settings-btn,
    body.in-menu #hotbar-wrap,
    body.in-menu #materials-wrap,
    body.in-menu #match-stats,
    body.in-menu #match-timer,
    body.in-menu #match-confetti-canvas,
    body.in-menu #scoreboard-overlay,
    body.in-menu #score-pop-layer,
    body.in-menu #shot-indicators,
    body.in-menu #player-name-labels {
      display: none;
    }

    body:not(.in-menu) .game-credit {
      display: none;
    }

    body.in-menu canvas {
      pointer-events: none;
      filter: blur(11px) saturate(1.08) brightness(0.78);
      transform: scale(1.05);
      transform-origin: center center;
    }

    body.match-loading #hotbar-wrap,
    body.match-loading #materials-wrap,
    body.match-loading #match-stats,
    body.match-loading #match-timer,
    body.match-loading #match-confetti-canvas,
    body.match-loading #scoreboard-overlay,
    body.match-loading #score-pop-layer,
    body.match-loading #settings-btn,
    body.match-loading #shot-indicators,
    body.match-loading #player-name-labels {
      display: none;
    }

    #match-loading-overlay {
      display: none;
      position: fixed;
      inset: 0;
      z-index: 45;
      background: rgba(26, 26, 46, 0.72);
      -webkit-backdrop-filter: blur(8px);
      backdrop-filter: blur(8px);
      align-items: center;
      justify-content: center;
      padding: 16px;
    }

    #match-loading-overlay.open {
      display: flex;
    }

    #match-loading-modal {
      width: min(360px, 92vw);
      text-align: center;
      color: rgba(255, 255, 255, 0.9);
    }

    #match-loading-label {
      font-size: 15px;
      margin-bottom: 14px;
    }

    .match-loading-track {
      height: 6px;
      border-radius: 3px;
      background: rgba(255, 255, 255, 0.12);
      overflow: hidden;
    }

    #match-loading-bar {
      height: 100%;
      width: 0%;
      border-radius: 3px;
      background: #ffd84b;
      transition: width 0.12s ease-out;
    }

    #main-menu-overlay {
      display: none;
      position: fixed;
      inset: 0;
      z-index: 40;
      background: rgba(26, 26, 46, 0.28);
      -webkit-backdrop-filter: blur(6px);
      backdrop-filter: blur(6px);
      align-items: center;
      justify-content: center;
      padding: 16px;
    }
    #main-menu-overlay.open {
      display: flex;
    }

    .menu-layout {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 18px;
      max-width: 96vw;
      max-height: 92vh;
    }

    .menu-brand-title {
      margin: 0;
      padding: 0;
      font-size: clamp(2.75rem, 11vw, 5rem);
      font-weight: 900;
      line-height: 1;
      letter-spacing: 0.22em;
      text-indent: 0.22em;
      text-align: center;
      text-transform: uppercase;
      color: transparent;
      background: linear-gradient(180deg, #ffffff 0%, #ffe566 38%, #ffd84b 55%, #c98a10 100%);
      -webkit-background-clip: text;
      background-clip: text;
      -webkit-text-fill-color: transparent;
      filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.55))
        drop-shadow(0 0 28px rgba(255, 216, 75, 0.5));
      user-select: none;
      flex-shrink: 0;
    }

    #main-menu-shell {
      --menu-panel-width: min(400px, 94vw);
      display: flex;
      align-items: flex-start;
      gap: 0;
      max-width: 96vw;
      max-height: 92vh;
      transition: gap 0.28s ease;
    }

    #main-menu-shell.menu-settings-open {
      gap: 10px;
      align-items: stretch;
    }

    #main-menu-shell.menu-settings-open #main-menu-modal,
    #main-menu-shell.menu-settings-open .menu-settings-panel {
      display: flex;
      align-self: stretch;
      max-height: none;
    }

    #main-menu-shell:not(.menu-settings-open) .menu-settings-panel {
      max-height: 0;
    }

    #main-menu-modal {
      box-sizing: border-box;
      width: var(--menu-panel-width);
      display: flex;
      flex-direction: column;
      max-height: 92vh;
      overflow-y: auto;
      background: #252540;
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: 12px;
      padding: 24px;
      color: #fff;
      flex-shrink: 0;
    }

    .menu-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 20px;
    }

    .menu-header-text {
      flex: 1;
      min-width: 0;
    }

    .menu-title {
      margin: 0;
      font-size: 22px;
      font-weight: 600;
      line-height: 1;
      color: #ffd84b;
    }

    .menu-header-actions {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-shrink: 0;
    }

    .menu-sound-btn .sound-icon-off {
      display: none;
    }

    .menu-sound-btn.is-muted .sound-icon-on {
      display: none;
    }

    .menu-sound-btn.is-muted .sound-icon-off {
      display: block;
    }

    .menu-sound-btn.is-muted {
      color: rgba(255, 255, 255, 0.45);
    }

    .menu-settings-btn {
      flex-shrink: 0;
      width: 36px;
      height: 36px;
      padding: 0;
      border: 1px solid rgba(255, 255, 255, 0.12);
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.06);
      color: rgba(255, 255, 255, 0.75);
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    }

    .menu-settings-btn:hover {
      background: rgba(255, 216, 75, 0.12);
      border-color: rgba(255, 216, 75, 0.35);
      color: #ffd84b;
    }

    .menu-settings-btn[aria-expanded="true"] {
      background: rgba(255, 216, 75, 0.18);
      border-color: rgba(255, 216, 75, 0.45);
      color: #ffd84b;
    }

    .menu-settings-btn svg {
      width: 20px;
      height: 20px;
    }

    .menu-settings-panel {
      flex-shrink: 0;
      width: 0;
      min-height: 0;
      overflow: hidden;
      opacity: 0;
      pointer-events: none;
      display: flex;
      transition: width 0.28s ease, opacity 0.22s ease;
    }

    #main-menu-shell.menu-settings-open .menu-settings-panel,
    #settings-shell.game-settings-open .menu-settings-panel {
      width: var(--menu-panel-width);
      opacity: 1;
      pointer-events: auto;
    }

    .menu-settings-panel-inner {
      flex: 1;
      width: var(--menu-panel-width);
      min-height: 100%;
      max-height: 92vh;
      overflow-y: auto;
      display: flex;
      flex-direction: column;
      gap: 10px;
      box-sizing: border-box;
      background: #252540;
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: 12px;
      padding: 20px;
      color: #fff;
    }

    .menu-settings-panel-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      margin-bottom: 4px;
    }

    .menu-settings-title {
      font-size: 16px;
      font-weight: 600;
      color: #ffd84b;
    }

    .menu-settings-close {
      width: 32px;
      height: 32px;
      padding: 0;
      border: none;
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.06);
      color: rgba(255, 255, 255, 0.7);
      font-size: 22px;
      line-height: 1;
      cursor: pointer;
    }

    .menu-settings-close:hover {
      background: rgba(255, 255, 255, 0.12);
      color: #fff;
    }

    .match-duration-field {
      margin-top: 14px;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .match-duration-tags {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
    }

    .match-duration-tag {
      padding: 6px 10px;
      border-radius: 4px;
      border: 1px solid rgba(255, 255, 255, 0.14);
      background: rgba(255, 255, 255, 0.04);
      color: rgba(255, 255, 255, 0.55);
      font-size: 11px;
      font-weight: 500;
      cursor: pointer;
      transition: background 0.15s, color 0.15s, border-color 0.15s;
    }

    .match-duration-tag:hover:not(.is-locked) {
      background: rgba(255, 255, 255, 0.08);
      color: rgba(255, 255, 255, 0.78);
    }

    .match-duration-tag.is-active {
      background: rgba(68, 204, 136, 0.14);
      border-color: rgba(68, 204, 136, 0.4);
      box-shadow: 0 0 0 1px rgba(68, 204, 136, 0.08);
      color: #b8f5d0;
    }

    .match-duration-tag.is-active:hover:not(.is-locked) {
      background: rgba(68, 204, 136, 0.2);
      border-color: rgba(68, 204, 136, 0.55);
      color: #b8f5d0;
    }

    .match-duration-tag.is-locked {
      opacity: 0.45;
      cursor: not-allowed;
    }

    .menu-settings-panel .peaceful-toggle {
      margin: 0;
    }

    .menu-guest-view .menu-host-panel {
      display: none;
    }

    .menu-guest-wait {
      margin: 8px 0 0;
      padding: 14px 12px;
      text-align: center;
      font-size: 14px;
      font-weight: 500;
      color: #ffd84b;
      background: rgba(255, 216, 75, 0.1);
      border: 1px solid rgba(255, 216, 75, 0.35);
      border-radius: 8px;
    }

    .menu-section {
      margin-bottom: 18px;
    }

    .menu-section-title {
      font-size: 13px;
      font-weight: 600;
      color: rgba(255, 255, 255, 0.75);
      margin-bottom: 10px;
    }

    .menu-section-title span {
      color: #ffd84b;
      font-weight: 500;
    }

    .party-slots {
      list-style: none;
      display: flex;
      flex-direction: column;
      gap: 6px;
    }

    .party-slot {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
      padding: 10px 12px;
      border-radius: 8px;
      font-size: 13px;
    }

    .party-slot-swatch {
      flex-shrink: 0;
      width: 10px;
      height: 10px;
      border-radius: 50%;
      background: rgba(255, 255, 255, 0.22);
    }

    .party-slot.filled .party-slot-swatch {
      background: var(--slot-color, #4a90d9);
    }

    .party-slot.filled {
      background: rgba(255, 255, 255, 0.06);
      border: 1px solid rgba(255, 255, 255, 0.14);
      border-left: 4px solid var(--slot-color, #4a90d9);
    }

    .party-slot.empty {
      background: rgba(255, 255, 255, 0.05);
      border: 1px dashed rgba(255, 255, 255, 0.18);
      color: rgba(255, 255, 255, 0.45);
    }

    .party-slot-name {
      flex: 1;
      font-weight: 500;
      color: #fff;
    }

    .party-slot.empty .party-slot-name {
      color: rgba(255, 255, 255, 0.55);
    }

    .party-slot-detail {
      font-size: 12px;
      color: rgba(255, 255, 255, 0.45);
    }

    .party-slot.filled .party-slot-detail {
      color: #ffd84b;
    }

    .menu-field {
      margin-bottom: 14px;
    }

    .menu-label {
      display: block;
      font-size: 12px;
      color: rgba(255, 255, 255, 0.5);
      margin-bottom: 6px;
    }

    .menu-code-input,
    #room-code {
      display: block;
      width: 100%;
      margin-bottom: 8px;
      padding: 10px 12px;
      border: 1px solid rgba(255, 255, 255, 0.15);
      border-radius: 8px;
      background: rgba(0, 0, 0, 0.25);
      color: #ffd84b;
      font-size: 16px;
      font-weight: 600;
      letter-spacing: 0.12em;
      text-align: center;
      font-family: inherit;
    }

    .menu-invite-card {
      padding: 12px;
      border-radius: 8px;
      border: 1px solid rgba(255, 255, 255, 0.14);
      background: rgba(255, 255, 255, 0.05);
    }

    .menu-invite-card .menu-code-input,
    .menu-invite-card #room-code {
      margin-bottom: 8px;
    }

    .menu-invite-actions {
      display: flex;
      gap: 8px;
    }

    .menu-invite-actions .menu-invite-btn {
      flex: 1;
      min-width: 0;
      margin: 0;
      padding: 10px 12px;
      font-size: 14px;
      font-weight: 500;
      text-align: center;
    }

    .menu-invite-actions .settings-action + .settings-action {
      margin-top: 0;
    }

    .menu-popup-overlay {
      display: none;
      position: fixed;
      inset: 0;
      z-index: 50;
      background: rgba(0, 0, 0, 0.55);
      align-items: center;
      justify-content: center;
      padding: 16px;
    }

    .menu-popup-overlay.open {
      display: flex;
    }

    .menu-popup-modal {
      width: min(320px, 92vw);
      padding: 20px;
      background: #252540;
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: 12px;
      color: #fff;
      box-sizing: border-box;
    }

    .menu-popup-title {
      font-size: 16px;
      font-weight: 600;
      color: #ffd84b;
      margin-bottom: 14px;
    }

    .menu-popup-modal .menu-code-input {
      margin-bottom: 0;
    }

    .menu-popup-actions {
      display: flex;
      gap: 8px;
      margin-top: 14px;
    }

    .menu-popup-actions .settings-action {
      flex: 1;
      margin: 0;
    }

    .menu-popup-actions .settings-action.menu-primary {
      margin-top: 0;
    }

    .menu-player-name-input {
      display: block;
      width: 100%;
      margin-bottom: 0;
      padding: 10px 12px;
      border: 1px solid rgba(255, 255, 255, 0.15);
      border-radius: 8px;
      background: rgba(0, 0, 0, 0.25);
      color: #fff;
      font-size: 15px;
      font-weight: 500;
      font-family: inherit;
      box-sizing: border-box;
    }

    .menu-player-name-input::placeholder {
      color: rgba(255, 255, 255, 0.35);
    }

    .menu-player-name-input:focus {
      outline: none;
      border-color: rgba(255, 216, 75, 0.45);
    }

    .menu-hint {
      text-align: center;
      font-size: 12px;
      color: rgba(255, 255, 255, 0.42);
      margin-top: 8px;
      line-height: 1.4;
    }
    .menu-hint-error {
      color: #ffb4b4;
    }
    .settings-action.menu-primary {
      margin-top: 14px;
      background: #ffd84b;
      color: #1a1a2e;
      font-weight: 600;
      font-size: 15px;
    }

    .settings-action.menu-primary:hover:not(:disabled) {
      background: #ffe566;
      color: #1a1a2e;
    }

    .settings-action.menu-primary:disabled {
      opacity: 1;
      cursor: not-allowed;
      background: rgba(255, 216, 75, 0.35);
      color: rgba(26, 26, 46, 0.45);
    }

    #settings-overlay {
      display: none;
      position: fixed;
      inset: 0;
      z-index: 20;
      background: rgba(0, 0, 0, 0.55);
      align-items: center;
      justify-content: center;
      padding: 16px;
    }
    #settings-overlay.open {
      display: flex;
    }

    #settings-shell {
      --menu-panel-width: min(360px, 90vw);
      display: flex;
      align-items: flex-start;
      gap: 0;
      max-width: 96vw;
      max-height: 92vh;
      transition: gap 0.28s ease;
    }

    #settings-shell:not(.game-settings-open) .menu-settings-panel {
      max-height: 0;
    }

    #settings-shell.game-settings-open #settings-modal,
    #settings-shell.game-settings-open .menu-settings-panel {
      align-self: stretch;
      max-height: none;
    }

    #settings-shell.game-settings-open .menu-settings-panel {
      display: flex;
    }

    #settings-shell.game-settings-open {
      gap: 10px;
      align-items: stretch;
    }

    #gameover-overlay {
      display: none;
      position: fixed;
      inset: 0;
      z-index: 30;
      background: rgba(0, 0, 0, 0.7);
      align-items: center;
      justify-content: center;
    }
    #gameover-overlay.open {
      display: flex;
    }

    #gameover-modal h2 {
      color: #ff5555;
    }

    #settings-modal {
      box-sizing: border-box;
      width: var(--menu-panel-width);
      display: flex;
      flex-direction: column;
      max-height: 92vh;
      overflow-y: auto;
      background: #252540;
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: 12px;
      padding: 24px;
      color: #fff;
      flex-shrink: 0;
    }

    #gameover-modal {
      box-sizing: border-box;
      width: var(--menu-panel-width);
      max-height: 92vh;
      overflow-y: auto;
      background: #252540;
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: 12px;
      padding: 24px;
      color: #fff;
    }

    .settings-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 14px;
    }

    .settings-title {
      margin: 0;
      font-size: 18px;
      font-weight: 600;
      color: #ffd84b;
    }

    #settings-modal .settings-action.menu-primary {
      margin-top: 0;
    }

    #settings-modal .settings-action + .settings-action {
      margin-top: 8px;
    }

    #gameover-modal h2 {
      font-size: 18px;
      font-weight: 600;
      margin-bottom: 16px;
    }
    #gameover-modal p {
      font-size: 14px;
      color: rgba(255, 255, 255, 0.5);
      margin-bottom: 20px;
    }
    .settings-hint {
      margin-bottom: 14px !important;
    }
    .settings-quit {
      color: #ffb4b4;
    }
    .settings-quit:hover {
      background: rgba(255, 100, 100, 0.18);
    }
    .settings-action {
      width: 100%;
      padding: 10px;
      border: none;
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.1);
      color: #fff;
      font-size: 14px;
      cursor: pointer;
      transition: background 0.15s;
    }
    .settings-action:hover {
      background: rgba(255, 255, 255, 0.18);
    }
    .settings-action + .settings-action {
      margin-top: 8px;
    }
    .settings-action.active {
      background: rgba(100, 200, 120, 0.25);
      color: #88ee99;
    }

    .settings-action:disabled,
    .settings-action.peaceful-locked {
      opacity: 0.45;
      cursor: not-allowed;
    }

    .settings-action:disabled:hover,
    .settings-action.peaceful-locked:hover {
      background: rgba(255, 255, 255, 0.1);
    }

    .peaceful-toggle {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 14px;
      width: 100%;
      padding: 12px 14px;
      margin-bottom: 8px;
      border-radius: 10px;
      background: rgba(255, 255, 255, 0.06);
      border: 1px solid rgba(255, 255, 255, 0.1);
      color: #fff;
      cursor: pointer;
      user-select: none;
      transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    }

    .peaceful-toggle:hover:not(.is-locked) {
      background: rgba(255, 255, 255, 0.1);
      border-color: rgba(255, 255, 255, 0.16);
    }

    .peaceful-toggle.is-on {
      background: rgba(68, 204, 136, 0.14);
      border-color: rgba(68, 204, 136, 0.4);
      box-shadow: 0 0 0 1px rgba(68, 204, 136, 0.08);
    }

    .peaceful-toggle.is-on:hover:not(.is-locked) {
      background: rgba(68, 204, 136, 0.2);
      border-color: rgba(68, 204, 136, 0.55);
    }

    .peaceful-toggle.is-locked {
      opacity: 0.5;
      cursor: not-allowed;
    }

    .peaceful-toggle:focus-visible {
      outline: 2px solid #ffd84b;
      outline-offset: 2px;
    }

    .peaceful-toggle-title {
      flex: 1;
      min-width: 0;
      text-align: left;
      font-size: 14px;
      font-weight: 600;
      color: #fff;
    }

    .peaceful-toggle.is-on .peaceful-toggle-title {
      color: #b8f5d0;
    }

    .peaceful-toggle-switch {
      flex-shrink: 0;
      width: 46px;
      height: 26px;
      border-radius: 13px;
      background: rgba(255, 255, 255, 0.18);
      position: relative;
      transition: background 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .peaceful-toggle.is-on .peaceful-toggle-switch {
      background: linear-gradient(180deg, #5fe09a 0%, #38b86e 100%);
    }

    .peaceful-toggle-switch::after {
      content: '';
      position: absolute;
      top: 3px;
      left: 3px;
      width: 20px;
      height: 20px;
      border-radius: 50%;
      background: #fff;
      box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
      transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .peaceful-toggle.is-on .peaceful-toggle-switch::after {
      transform: translateX(20px);
    }

    #hotbar-wrap {
      position: fixed;
      bottom: 20px;
      left: 50%;
      transform: translateX(-50%);
      display: flex;
      flex-direction: column;
      align-items: center;
      z-index: 10;
    }
    .hotbar-row {
      display: flex;
      align-items: center;
      gap: 24px;
    }
    .whistle-btn {
      position: relative;
      flex-shrink: 0;
      width: 46px;
      height: 46px;
      padding: 0;
      border: none;
      border-radius: 50%;
      background: rgba(0, 0, 0, 0.45);
      cursor: pointer;
      transition: transform 0.1s;
    }
    .whistle-btn:hover:not(:disabled) {
      transform: scale(1.04);
    }
    .whistle-btn.is-ready .whistle-ring-bg {
      stroke: rgba(255, 216, 75, 0.22);
    }
    .whistle-btn.is-ready .whistle-ring-progress {
      stroke: #ffd84b;
      stroke-dashoffset: 0;
    }
    .whistle-cooldown-svg {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      pointer-events: none;
    }
    .whistle-ring-bg,
    .whistle-ring-progress {
      fill: none;
      stroke-width: 2.5;
      transform: rotate(-90deg);
      transform-origin: 50% 50%;
    }
    .whistle-ring-bg {
      stroke: rgba(255, 255, 255, 0.12);
    }
    .whistle-ring-progress {
      stroke: rgba(255, 255, 255, 0.35);
      stroke-linecap: round;
      transition: stroke 0.15s;
    }
    .whistle-key-badge {
      position: absolute;
      top: -5px;
      right: -5px;
      z-index: 2;
      min-width: 17px;
      height: 17px;
      padding: 0 4px;
      border-radius: 4px;
      font-size: 10px;
      font-weight: 700;
      line-height: 17px;
      text-align: center;
      color: rgba(255, 255, 255, 0.92);
      background: rgba(30, 32, 36, 0.92);
      border: 1px solid rgba(255, 255, 255, 0.28);
      box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
      pointer-events: none;
      user-select: none;
    }
    .whistle-icon {
      position: relative;
      width: 28px;
      height: 28px;
      object-fit: contain;
      pointer-events: none;
      -webkit-user-drag: none;
      user-select: none;
      transition: filter 0.15s, opacity 0.15s;
    }
    .whistle-btn:not(.is-ready) .whistle-icon {
      filter: grayscale(1) brightness(0.7);
      opacity: 0.5;
    }
    #hotbar {
      display: flex;
      gap: 5px;
    }
    .hotbar-slot {
      position: relative;
      width: 46px;
      height: 46px;
      background: rgba(0, 0, 0, 0.45);
      border: 2px solid rgba(255, 255, 255, 0.2);
      border-radius: 5px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
    }
    .hotbar-slot.selected {
      border-color: #fff;
      background: rgba(255, 255, 255, 0.12);
    }
    .ammo-badge {
      position: absolute;
      right: 2px;
      bottom: 2px;
      font-size: 9px;
      font-weight: 600;
      color: rgba(255, 220, 120, 0.95);
      line-height: 1.2;
      padding: 2px 5px;
      border-radius: 8px;
      background: rgba(0, 0, 0, 0.55);
      pointer-events: none;
    }
    .ammo-badge.reloading {
      animation: ammo-reload-blink 0.5s ease-in-out infinite;
    }
    @keyframes ammo-reload-blink {
      0%,
      100% {
        opacity: 1;
        color: #ff5555;
        background: rgba(140, 20, 20, 0.9);
        box-shadow: 0 0 6px rgba(255, 60, 60, 0.8);
      }
      50% {
        opacity: 0.2;
        color: #ff9999;
        background: rgba(50, 0, 0, 0.35);
        box-shadow: none;
      }
    }
    .hotbar-item-icon {
      width: 34px;
      height: 34px;
      object-fit: contain;
      pointer-events: none;
      -webkit-user-drag: none;
      user-select: none;
    }

    .match-stats-card {
      position: fixed;
      right: 16px;
      bottom: 20px;
      z-index: 10;
      height: 46px;
      box-sizing: border-box;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 2px;
      padding: 0 10px;
      min-width: 76px;
      background: rgba(0, 0, 0, 0.45);
      border: 2px solid rgba(255, 255, 255, 0.2);
      border-radius: 5px;
      pointer-events: none;
    }

    .match-stat-line {
      display: flex;
      align-items: baseline;
      justify-content: center;
      gap: 4px;
      line-height: 1;
    }

    .match-stat-km {
      gap: 3px;
    }

    .match-stat-label,
    .match-stat-letter,
    .match-stat-sep {
      font-size: 9px;
      font-weight: 500;
      color: rgba(255, 255, 255, 0.42);
      letter-spacing: 0.03em;
    }

    .match-stat-label {
      text-transform: uppercase;
      margin-right: 2px;
    }

    .match-stat-sep {
      margin: 0 1px;
      color: rgba(255, 255, 255, 0.28);
    }

    .match-stat-num {
      font-size: 13px;
      font-weight: 600;
      color: rgba(255, 255, 255, 0.92);
      font-variant-numeric: tabular-nums;
    }

    #materials-wrap {
      position: fixed;
      right: 16px;
      top: 50%;
      transform: translateY(-50%);
      display: flex;
      flex-direction: column;
      gap: 8px;
      z-index: 10;
      pointer-events: none;
    }

    .material-slot {
      position: relative;
      width: 46px;
      height: 46px;
      background: rgba(0, 0, 0, 0.45);
      border: 2px solid rgba(255, 255, 255, 0.2);
      border-radius: 5px;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .material-count {
      position: absolute;
      right: 2px;
      bottom: 2px;
      font-size: 10px;
      font-weight: 600;
      color: rgba(255, 255, 255, 0.92);
      line-height: 1.2;
      padding: 2px 5px;
      border-radius: 8px;
      background: rgba(0, 0, 0, 0.55);
      min-width: 14px;
      text-align: center;
    }

    .material-icon {
      width: 30px;
      height: 30px;
      object-fit: contain;
      pointer-events: none;
      -webkit-user-drag: none;
      user-select: none;
    }

.match-timer {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: rgba(200, 205, 212, 0.72);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  user-select: none;
}

.game-credit {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 41;
  margin: 0;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: rgba(200, 205, 212, 0.72);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  text-align: center;
  user-select: none;
}

.game-credit a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.game-credit a:hover {
  color: rgba(255, 216, 75, 0.9);
}

.match-confetti-canvas {
  position: fixed;
  inset: 0;
  z-index: 17;
  pointer-events: none;
  display: none;
}

.match-confetti-canvas.active {
  display: block;
}

#scoreboard-overlay {
  position: fixed;
  inset: 0;
  z-index: 14;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 72px 16px 16px;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.35);
}

#scoreboard-overlay.scoreboard-overlay--pinned {
  pointer-events: auto;
  background: rgba(0, 0, 0, 0.5);
}

#scoreboard-overlay[hidden] {
  display: none;
}

.scoreboard-panel {
  min-width: 280px;
  max-width: min(92vw, 360px);
  padding: 12px 14px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

.scoreboard-title {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
}

.scoreboard-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.scoreboard-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 6px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  border-left: 3px solid var(--player-color, rgba(255, 255, 255, 0.3));
}

.scoreboard-row.is-local {
  background: rgba(255, 255, 255, 0.1);
}

.scoreboard-row.is-winner {
  background: rgba(255, 216, 75, 0.18);
  box-shadow: 0 0 0 1px rgba(255, 216, 75, 0.35), 0 0 18px rgba(255, 216, 75, 0.2);
}

.scoreboard-rank {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #1a1408;
  background: linear-gradient(180deg, #ffe566 0%, #ffd84b 100%);
  vertical-align: middle;
}

.scoreboard-name {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.9);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scoreboard-tag {
  margin-left: 6px;
  font-size: 9px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
}

.scoreboard-score {
  font-size: 14px;
  font-weight: 700;
  color: #ffd84b;
  font-variant-numeric: tabular-nums;
  min-width: 2ch;
  text-align: right;
}

.scoreboard-kd {
  display: flex;
  align-items: baseline;
  gap: 2px;
  min-width: 52px;
  justify-content: flex-end;
}

.scoreboard-kd .scoreboard-num {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  font-variant-numeric: tabular-nums;
}

.scoreboard-kd .scoreboard-letter,
.scoreboard-kd .scoreboard-sep {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.42);
}

.scoreboard-kd .scoreboard-sep {
  margin: 0 2px;
  color: rgba(255, 255, 255, 0.28);
}

.scoreboard-empty {
  margin: 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
  text-align: center;
}

.scoreboard-hint {
  margin: 10px 0 0;
  font-size: 9px;
  color: rgba(255, 255, 255, 0.32);
  text-align: center;
}

.scoreboard-end-btn {
  display: block;
  width: 100%;
  margin-top: 12px;
  pointer-events: auto;
}

#score-pop-layer {
  position: fixed;
  z-index: 13;
  pointer-events: none;
  visibility: hidden;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-start;
  gap: 3px;
}

.score-popup {
  display: block;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #ffd84b;
  text-shadow:
    0 0 10px rgba(255, 210, 50, 0.75),
    0 0 3px rgba(255, 180, 30, 0.5),
    0 1px 2px rgba(0, 0, 0, 0.85);
  animation: score-pop-in 0.42s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: calc(var(--pop-i, 0) * 28ms);
  will-change: transform, opacity;
}

.score-popup--kill {
  font-size: 17px;
  color: #ffe97a;
  text-shadow:
    0 0 14px rgba(255, 220, 80, 0.9),
    0 0 4px rgba(255, 190, 40, 0.6),
    0 1px 3px rgba(0, 0, 0, 0.9);
}

.score-popup--loss {
  color: #ff6b6b;
  text-shadow:
    0 0 10px rgba(255, 80, 80, 0.75),
    0 0 3px rgba(200, 40, 40, 0.5),
    0 1px 2px rgba(0, 0, 0, 0.85);
}

.score-popup--bump {
  animation: score-pop-bump 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.score-popup--out {
  animation: score-pop-out 0.55s ease-in forwards;
}

@keyframes score-pop-in {
  0% {
    opacity: 0;
    transform: translate(0, 10px) scale(0.55);
  }
  55% {
    opacity: 1;
    transform: translate(0, -4px) scale(1.1);
  }
  100% {
    opacity: 1;
    transform: translate(0, -6px) scale(1);
  }
}

@keyframes score-pop-bump {
  0% {
    transform: translate(0, -6px) scale(1);
  }
  40% {
    transform: translate(0, -10px) scale(1.18);
  }
  100% {
    transform: translate(0, -6px) scale(1);
  }
}

@keyframes score-pop-out {
  0% {
    opacity: 1;
    transform: translate(0, -6px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(4px, -30px) scale(0.9);
  }
}

#shot-indicators,
#player-name-labels {
  position: fixed;
  inset: 0;
  z-index: 12;
  pointer-events: none;
  overflow: hidden;
}

.player-name-label {
  position: fixed;
  display: none;
  transform: translate(-50%, -100%);
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
  white-space: nowrap;
  pointer-events: none;
}

.shot-indicator {
  position: fixed;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: opacity 0.12s linear;
}

.shot-indicator-dist {
  font-size: 13px;
  font-weight: 600;
  color: #ffdd33;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
  white-space: nowrap;
}

.shot-indicator--whistle .shot-indicator-dist {
  color: rgba(190, 194, 205, 0.95);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

/* Plein écran géré en CSS : Échap ne l'affecte pas */
html.game-fullscreen,
html.game-fullscreen body {
  overflow: hidden;
  background: #1a1a2e;
}
