:root {
  --bg: #14101e;
  --panel: #221b33;
  --panel-2: #2d2442;
  --line: #3d3259;
  --text: #f3eefc;
  --muted: #a99fc2;
  --accent: #ffd640;
  --accent-ink: #2a2100;
  --danger: #ff5c7a;
  --hp: #44d17a;
  --hp-mid: #f5c542;
  --hp-low: #ff5c5c;
  --xp: #5cb8ff;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, 'Segoe UI', sans-serif;
}

[hidden] {
  display: none !important;
}

button {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border: 0;
  border-radius: 10px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  padding: 9px 14px;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 3px 0 rgba(0, 0, 0, .35);
  transition: transform .06s, filter .15s;
}

button:hover:not(:disabled) {
  filter: brightness(1.08);
}

button:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .35);
}

button:disabled {
  opacity: .45;
  cursor: default;
}

button.secondary {
  background: var(--panel-2);
  color: var(--text);
}

button.danger {
  background: var(--danger);
  color: #fff;
}

button.icon {
  padding: 4px 10px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}

kbd {
  font-size: 11px;
  opacity: .6;
  border: 1px solid currentColor;
  border-radius: 4px;
  padding: 0 4px;
  margin-left: 4px;
}

input {
  font: inherit;
  color: var(--text);
  background: #120e1b;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  width: 100%;
}

input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ---------- Auth ---------- */
.screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: radial-gradient(circle at 30% 20%, #3b2a66, transparent 60%), radial-gradient(circle at 80% 90%, #1f4a3a, transparent 50%), var(--bg);
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px;
  width: min(380px, 100%);
  display: grid;
  gap: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .4);
}

.card h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: -.5px;
}

.card h1 span {
  color: var(--accent);
}

.subtitle {
  margin: -8px 0 4px;
  color: var(--muted);
}

.card label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.google-slot {
  display: flex;
  justify-content: center;
  min-height: 44px;
}

.auth-new,
.auth-form {
  display: grid;
  gap: 12px;
}

.auth-hint {
  margin: 0;
  font-size: 14px;
}

.link-button {
  background: none;
  border: 0;
  padding: 0;
  color: var(--muted);
  font-size: 13px;
  text-decoration: underline;
  justify-self: start;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.row button {
  flex: 1;
}

.error {
  color: var(--danger);
  margin: 0;
  min-height: 1.4em;
  font-size: 14px;
}

/* ---------- HUD ---------- */
#world {
  position: fixed;
  inset: 0;
  display: block;
}

#hud-top {
  position: fixed;
  top: 12px;
  left: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  max-width: calc(100% - 220px);
}

#hud-top>span {
  background: rgba(20, 16, 30, .75);
  backdrop-filter: blur(4px);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

#zone-name {
  color: #b8f5a0;
}

#online-count {
  color: var(--muted);
}

#hud-actions {
  position: fixed;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
}

#hud-actions button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#hud-actions kbd {
  margin-left: 0;
}

.touch-only {
  display: none !important;
}

#chat {
  position: fixed;
  left: 12px;
  bottom: 12px;
  width: min(360px, calc(100% - 24px));
  display: grid;
  gap: 6px;
}

#chat-log {
  max-height: 160px;
  overflow-y: auto;
  font-size: 13px;
  display: grid;
  gap: 2px;
}

#chat-log div {
  background: rgba(20, 16, 30, .65);
  padding: 3px 8px;
  border-radius: 6px;
  width: fit-content;
  max-width: 100%;
  overflow-wrap: anywhere;
}

#chat-log b {
  color: var(--accent);
}

#chat-input {
  background: rgba(18, 14, 27, .8);
  padding: 8px 12px;
}

#toast {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translate(-50%, -20px);
  opacity: 0;
  pointer-events: none;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 10px 16px;
  border-radius: 12px;
  transition: opacity .2s, transform .2s;
  max-width: calc(100% - 32px);
  text-align: center;
  z-index: 50;
}

#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

#dpad {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: grid;
  grid-template: repeat(3, 56px) / repeat(3, 56px);
  gap: 4px;
  touch-action: none;
}

#dpad button {
  background: rgba(34, 27, 51, .75);
  color: var(--text);
  font-size: 20px;
  padding: 0;
}

#dpad [data-dir=up] {
  grid-area: 1 / 2;
}

#dpad [data-dir=left] {
  grid-area: 2 / 1;
}

#dpad [data-dir=right] {
  grid-area: 2 / 3;
}

#dpad [data-dir=down] {
  grid-area: 3 / 2;
}

/* ---------- Équipe ---------- */
#team-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(400px, 100%);
  background: var(--panel);
  border-left: 1px solid var(--line);
  padding: 16px;
  overflow-y: auto;
  z-index: 20;
  box-shadow: -20px 0 50px rgba(0, 0, 0, .4);
}

#team-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#team-panel h2 {
  margin: 0;
  font-size: 20px;
}

#team-panel h3 {
  margin: 18px 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}

.mon-list {
  display: grid;
  gap: 8px;
}

.mon-card {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 10px;
  background: var(--panel-2);
  border-radius: 12px;
  padding: 10px;
  align-items: center;
}

.mon-card img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  background: rgba(0, 0, 0, .2);
  border-radius: 10px;
}

.mon-card .body {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.mon-card .title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.mon-card small {
  color: var(--muted);
  font-size: 12px;
}

.card-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.card-actions button {
  padding: 5px 10px;
  font-size: 13px;
}

.empty {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}

.rarity-badge {
  --c: #999;
  justify-self: start;
  width: fit-content;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--c);
  border: 1px solid var(--c);
  border-radius: 999px;
  padding: 0 8px;
}

.bar {
  height: 8px;
  background: rgba(0, 0, 0, .4);
  border-radius: 999px;
  overflow: hidden;
}

.bar>div {
  height: 100%;
  width: 100%;
  background: var(--hp);
  border-radius: inherit;
  transition: width .5s ease;
}

.bar.mid>div {
  background: var(--hp-mid);
}

.bar.low>div {
  background: var(--hp-low);
}

.bar.xp {
  height: 4px;
}

.bar.xp>div {
  background: var(--xp);
}

/* ---------- Combat ---------- */
#battle {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  grid-template-rows: 1fr auto;
  background: linear-gradient(#8fd3ff 0%, #c9ecff 45%, #7cc86a 45%, #5aa84b 100%);
}

/* Fond choisi dans l'admin (pixel art : agrandi sans flou, sans toucher aux sprites des monstres). */
#battle.has-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--battle-bg) center bottom / cover no-repeat, #5aa84b;
  image-rendering: pixelated;
}

#battle.intro {
  animation: battle-in .45s ease-out;
}

@keyframes battle-in {
  from {
    clip-path: circle(0% at 50% 50%);
  }

  to {
    clip-path: circle(75% at 50% 50%);
  }
}

.arena {
  position: relative;
  display: grid;
  grid-template-rows: 1fr 1fr;
  padding: 16px clamp(16px, 5vw, 80px);
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
}

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

.side .info {
  background: rgba(20, 16, 30, .85);
  border-radius: 14px;
  padding: 10px 14px;
  width: min(300px, 48vw);
  display: grid;
  gap: 6px;
}

.side .title {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  gap: 8px;
}

.side .hptext {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}

.pedestal {
  position: relative;
  display: grid;
  place-items: center;
}

.pedestal::after {
  content: '';
  position: absolute;
  bottom: 4%;
  width: 90%;
  height: 18%;
  background: rgba(0, 0, 0, .2);
  border-radius: 50%;
  z-index: -1;
}

.sprite {
  width: clamp(110px, 22vw, 220px);
  height: clamp(110px, 22vw, 220px);
  object-fit: contain;
}

.pedestal .fx {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 130%;
  aspect-ratio: 1;
  translate: -50% -50%;
  object-fit: contain;
  image-rendering: pixelated;
  pointer-events: none;
  z-index: 2;
}

.pedestal .fx.mirror {
  scale: -1 1;
}

.side.wild .sprite {
  animation: float 2.4s ease-in-out infinite;
}

.side.mine .sprite {
  transform: scaleX(-1);
}

@keyframes float {
  50% {
    translate: 0 -8px;
  }
}

.sprite.hit {
  animation: hit .4s;
}

.side.mine .sprite.hit {
  animation: hit-mine .4s;
}

@keyframes hit {

  0%,
  100% {
    translate: 0;
    filter: none;
  }

  20% {
    translate: -10px;
    filter: brightness(2.5);
  }

  40% {
    translate: 10px;
  }

  60% {
    translate: -6px;
    filter: brightness(2);
  }

  80% {
    translate: 4px;
  }
}

@keyframes hit-mine {

  0%,
  100% {
    translate: 0;
    filter: none;
  }

  20% {
    translate: 10px;
    filter: brightness(2.5);
  }

  40% {
    translate: -10px;
  }

  60% {
    translate: 6px;
  }
}

@keyframes faint {
  to {
    translate: 0 40px;
    opacity: 0;
  }
}

#battle .panel {
  background: var(--panel);
  border-top: 3px solid var(--line);
  padding: 14px clamp(16px, 5vw, 80px) 18px;
  display: grid;
  gap: 12px;
}

#battle .log {
  min-height: 72px;
  display: grid;
  gap: 2px;
  align-content: start;
}

#battle .log p {
  margin: 0;
  animation: line-in .2s ease-out;
}

@keyframes line-in {
  from {
    opacity: 0;
    translate: -6px 0;
  }

  to {
    opacity: 1;
    translate: 0;
  }
}

#battle .actions {
  display: grid;
  gap: 8px;
}

#battle .other {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

#battle .other button {
  padding: 7px 10px;
  font-size: 14px;
}

/* Tirage pierre-feuille-ciseaux */
@keyframes shake-mine {
  0% {
    translate: -60px 0;
    opacity: 0;
  }

  60% {
    translate: 6px 0;
    opacity: 1;
  }

  100% {
    translate: 0;
  }
}

@keyframes shake-wild {
  0% {
    translate: 60px 0;
    opacity: 0;
  }

  60% {
    translate: -6px 0;
    opacity: 1;
  }

  100% {
    translate: 0;
  }
}

.choice-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}

.choice-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel-2);
  color: var(--text);
  text-align: left;
  padding: 8px 12px;
}

.choice-item img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.choice-item small {
  margin-left: auto;
  color: var(--muted);
  font-weight: 500;
}

.choice-hint {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-style: italic;
}

#battle .continue {
  justify-self: end;
  min-width: 160px;
}

img.pixel {
  image-rendering: pixelated;
}

/* ---------- Pokédex ---------- */
.dex-overlay {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(10, 8, 18, .6);
  backdrop-filter: blur(3px);
}

.dex {
  width: min(980px, 100%);
  height: min(680px, 100%);
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}

.dex-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
}

.dex-head h2 {
  margin: 0;
  font-size: 22px;
}

.dex-progress-text {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.dex-progress {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .4);
  overflow: hidden;
}

.dex-progress>div {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
  transition: width .5s ease;
}

.dex-progress .seen {
  background: color-mix(in srgb, var(--xp) 45%, transparent);
}

.dex-progress .caught {
  background: var(--accent);
}

.dex-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.dex-filters button {
  background: var(--panel-2);
  color: var(--muted);
  box-shadow: none;
  padding: 6px 12px;
  font-size: 13px;
}

.dex-filters button.active {
  background: var(--accent);
  color: var(--accent-ink);
}

.dex-body {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 14px;
  min-height: 0;
}

.dex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
  align-content: start;
  overflow-y: auto;
  padding-right: 4px;
}

.dex-card {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 10px 6px 8px;
  background: var(--panel-2);
  color: var(--text);
  border: 2px solid transparent;
  box-shadow: none;
  font-weight: 600;
  font-size: 13px;
}

.dex-card.active {
  border-color: var(--accent);
}

.dex-card img {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.dex-card .dex-number {
  justify-self: start;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.dex-card .dex-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dex-caught {
  position: absolute;
  top: 6px;
  right: 8px;
  color: var(--accent);
  font-size: 13px;
}

/* Inconnu : silhouette noire ; vu : couleurs atténuées ; capturé : couleurs pleines. */
.dex-card.unknown img,
.dex-portrait.unknown img {
  filter: brightness(0);
  opacity: .55;
}

.dex-card.unknown .dex-name {
  color: var(--muted);
}

.dex-card.seen img,
.dex-portrait.seen img {
  filter: grayscale(.7) opacity(.8);
}

.dex-back {
  display: none;
  justify-self: start;
}

@media (max-width: 760px) {
  .dex-back {
    display: inline-flex;
  }
}

.dex-detail {
  display: grid;
  gap: 8px;
  align-content: start;
  background: var(--panel-2);
  border-radius: 14px;
  padding: 14px;
  overflow-y: auto;
}

.dex-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.dex-status {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid currentColor;
}

.dex-status.caught {
  color: var(--accent);
}

.dex-status.seen {
  color: var(--xp);
}

.dex-portrait {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  background: radial-gradient(circle, rgba(255, 255, 255, .08), transparent 70%);
}

/* Hors du flux : un grand PNG ne peut pas agrandir le portrait. */
.dex-portrait img {
  position: absolute;
  inset: 15%;
  width: 70%;
  height: 70%;
  object-fit: contain;
}

.dex-detail h3 {
  margin: 0;
  font-size: 20px;
}

.dex-detail h4 {
  margin: 6px 0 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}

.dex-history {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.dex-description {
  margin: 0;
  line-height: 1.5;
}

.dex-hint {
  margin: 0;
  color: var(--muted);
  font-style: italic;
  font-size: 13px;
}

.dex-habitats {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 2px;
  font-size: 14px;
}

@media (max-width: 720px) {
  .dex {
    height: 100%;
    padding: 14px;
  }

  .dex-body {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }

  .dex-detail {
    max-height: 45vh;
  }
}

/* Progression de capture dans la zone courante */
#zone-name .zone-shiny {
  margin-left: 8px;
  color: #ffe27a;
  font-weight: 700;
}

#zone-name .zone-progress {
  margin-left: 8px;
  padding-left: 8px;
  border-left: 1px solid rgba(255, 255, 255, .2);
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

#zone-name.complete .zone-progress {
  color: var(--hp);
}


/* ---------- Types, chromatiques ---------- */
.badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.element-badge {
  --c: #999;
  width: fit-content;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--c) 22%, transparent);
  color: color-mix(in srgb, var(--c) 70%, white);
  border: 1px solid color-mix(in srgb, var(--c) 60%, transparent);
}

img.shiny {
  filter: hue-rotate(150deg) saturate(1.4) brightness(1.1);
}

.sparkles {
  position: absolute;
  top: 4%;
  right: 10%;
  font-size: clamp(18px, 3vw, 30px);
  pointer-events: none;
  animation: sparkle 1.4s ease-in-out infinite;
}

@keyframes sparkle {

  0%,
  100% {
    opacity: .2;
    scale: .7;
    rotate: 0deg;
  }

  50% {
    opacity: 1;
    scale: 1.2;
    rotate: 20deg;
  }
}

.mon-card.is-shiny {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 60%, transparent);
}

.mon-card .title {
  align-items: center;
}

.mon-card .title strong {
  margin-right: auto;
}

.rename {
  font-size: 12px;
  padding: 0 4px;
  opacity: .6;
}

.rename:hover {
  opacity: 1;
}

.rename-input {
  padding: 2px 6px;
  font-size: 14px;
  margin-right: auto;
  max-width: 160px;
}

/* ---------- HUD ---------- */
#coins b {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.icon-btn {
  padding: 9px 11px;
}

.hint-bubble {
  position: fixed;
  top: 58px;
  right: 12px;
  margin: 0;
  max-width: 260px;
  font-size: 12px;
  color: var(--muted);
  background: rgba(20, 16, 30, .7);
  padding: 6px 10px;
  border-radius: 10px;
  pointer-events: none;
  animation: fade-hint 1s ease 12s forwards;
}

@keyframes fade-hint {
  to {
    opacity: 0;
  }
}

@media (max-width: 720px) {
  .hint-bubble {
    display: none;
  }
}

.player-menu {
  position: fixed;
  z-index: 22;
  display: grid;
  gap: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 10px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
  min-width: 180px;
}

.invite {
  position: fixed;
  z-index: 28;
  left: 50%;
  bottom: 90px;
  translate: -50% 0;
  width: min(380px, calc(100% - 32px));
  background: var(--panel);
  border: 2px solid var(--accent);
  border-radius: 16px;
  padding: 14px 16px;
  display: grid;
  gap: 10px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
  animation: pop-in .25s ease-out;
}

.invite p {
  margin: 0;
}

@keyframes pop-in {
  from {
    scale: .85;
    opacity: 0;
  }
}

/* ---------- Fenêtres modales (boutique, classement) ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(10, 8, 18, .6);
  backdrop-filter: blur(3px);
}

.modal {
  width: min(620px, 100%);
  max-height: 100%;
  overflow-y: auto;
  display: grid;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
}

.modal-head h2 {
  margin: 0;
  font-size: 22px;
}

.muted {
  color: var(--muted);
  margin: 2px 0 0;
  font-size: 13px;
}

.muted b {
  color: var(--accent);
}

.shop-list {
  display: grid;
  gap: 8px;
}

.shop-item {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 12px;
  align-items: center;
  background: var(--panel-2);
  border-radius: 12px;
  padding: 10px 12px;
}

.shop-icon {
  font-size: 28px;
  text-align: center;
}

.shop-info {
  display: grid;
  gap: 2px;
}

.shop-info small {
  color: var(--muted);
}

.shop-buy {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: end;
}

.shop-buy button {
  padding: 6px 10px;
  font-size: 13px;
}

@media (max-width: 560px) {
  .shop-item {
    grid-template-columns: 32px 1fr;
  }

  .shop-buy {
    grid-column: 1 / -1;
    justify-content: start;
  }
}

.ranking table {
  width: 100%;
  border-collapse: collapse;
}

.ranking th,
.ranking td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}

.ranking th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.online-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--hp);
}

/* ---------- Combat : duel, attente ---------- */
.battle-banner {
  position: absolute;
  top: 14px;
  left: 50%;
  translate: -50% 0;
  z-index: 3;
  background: rgba(20, 16, 30, .85);
  color: var(--accent);
  font-weight: 800;
  padding: 6px 16px;
  border-radius: 999px;
  letter-spacing: .02em;
}

#battle.duel-mode {
  background: linear-gradient(#f7a26b 0%, #f9d29a 45%, #b08be0 45%, #7c5cc4 100%);
}

#battle .waiting {
  margin: 0;
  text-align: center;
  font-weight: 700;
  color: var(--accent);
  animation: blink 1.2s ease-in-out infinite;
}

@keyframes blink {
  50% {
    opacity: .45;
  }
}

.side .badges {
  margin-top: -2px;
}

/* ---------- Évolution ---------- */
.evolution {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 22px;
  background: radial-gradient(circle, #3b2a66, #0b0914 70%);
  color: #fff;
  text-align: center;
  padding: 16px;
}

.evolution-stage {
  position: relative;
  width: clamp(160px, 30vw, 260px);
  aspect-ratio: 1;
}

.evolution-stage img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.evolution .evo-to {
  opacity: 0;
}

.evolution.evolving .evo-from {
  animation: evo-flash 2.6s ease-in forwards;
}

.evolution.evolving .evo-to {
  animation: evo-reveal .6s ease-out 2.4s forwards;
}

@keyframes evo-flash {
  0% {
    filter: brightness(1);
  }

  15% {
    filter: brightness(4);
  }

  25% {
    filter: brightness(1);
  }

  40% {
    filter: brightness(5);
  }

  50% {
    filter: brightness(1.5);
  }

  65% {
    filter: brightness(8);
  }

  75% {
    filter: brightness(3);
  }

  90% {
    filter: brightness(12);
    scale: 1.1;
  }

  100% {
    filter: brightness(20);
    opacity: 0;
    scale: 1.2;
  }
}

@keyframes evo-reveal {
  from {
    opacity: 0;
    filter: brightness(10);
    scale: .6;
  }

  to {
    opacity: 1;
    filter: none;
    scale: 1;
  }
}

.evolution-text {
  font-size: clamp(18px, 3vw, 26px);
  font-weight: 800;
  margin: 0;
  max-width: 600px;
}

/* ---------- Notice ---------- */
.modal.help {
  width: min(900px, 100%);
  height: min(720px, 100%);
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.help-body {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 16px;
  min-height: 0;
}

.help-nav {
  display: grid;
  gap: 4px;
  align-content: start;
  overflow-y: auto;
}

.help-nav button {
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  text-align: left;
  padding: 7px 10px;
  font-weight: 600;
}

.help-nav button:hover {
  background: var(--panel-2);
  color: var(--text);
}

.help-content {
  overflow-y: auto;
  padding-right: 6px;
  scroll-behavior: smooth;
}

.help-content section {
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.help-content section:last-child {
  border-bottom: 0;
}

.help-content h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.help-content p,
.help-content li {
  line-height: 1.55;
}

.help-content p {
  margin: 0 0 8px;
}

.help-content ul {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 6px;
}

.help-content b {
  color: var(--accent);
  font-weight: 700;
}

.help-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 6px 0 10px;
  font-size: 14px;
}

.help-content th,
.help-content td {
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.help-content th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.help-content kbd {
  opacity: 1;
  margin: 0;
  padding: 1px 6px;
  font-size: 12px;
  background: var(--panel-2);
  border-color: var(--line);
}

@media (max-width: 720px) {
  .modal.help {
    height: 100%;
  }

  .help-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .help-nav {
    display: flex;
    overflow-x: auto;
  }

  .help-nav button {
    white-space: nowrap;
  }
}

/* ---------- Mise en scène des combats ---------- */
#battle .log {
  min-height: 78px;
  font-size: 16px;
}

#battle .skip-hint {
  margin: -6px 0 0;
  font-size: 11px;
  color: var(--muted);
  text-align: right;
}

.arena.flash {
  animation: arena-flash .35s ease-out;
}

@keyframes arena-flash {
  0% {
    filter: brightness(2.2) saturate(.3);
  }

  100% {
    filter: none;
  }
}

.side.mine .sprite.hit-ally {
  animation: hit-mine .5s;
}

.side.wild .sprite.enter-foe {
  animation: enter-foe .6s cubic-bezier(.2, .8, .3, 1.2), float 2.4s ease-in-out .6s infinite;
}

.side.mine .sprite.enter-ally {
  animation: enter-ally .6s cubic-bezier(.2, .8, .3, 1.2);
}

@keyframes enter-foe {
  from {
    translate: 60vw 0;
    opacity: 0;
  }

  to {
    translate: 0;
    opacity: 1;
  }
}

@keyframes enter-ally {
  from {
    translate: -60vw 0;
    opacity: 0;
  }

  to {
    translate: 0;
    opacity: 1;
  }
}

.info.info-in {
  animation: info-in .5s ease-out;
}

@keyframes info-in {
  from {
    opacity: 0;
    translate: 0 -10px;
  }
}

.info.level-up {
  animation: level-up .6s ease-out;
}

@keyframes level-up {
  30% {
    box-shadow: 0 0 0 3px var(--accent), 0 0 24px var(--accent);
  }
}

.sprite.healed {
  animation: healed .7s ease-out;
}

@keyframes healed {
  40% {
    filter: brightness(1.6) drop-shadow(0 0 12px #7dffb0);
  }
}

@keyframes leave {
  to {
    translate: -60vw 0;
    opacity: 0;
  }
}

@keyframes leave-foe {
  to {
    translate: 60vw 0;
    opacity: 0;
  }
}

@keyframes absorbed {
  to {
    scale: .1;
    opacity: 0;
    filter: brightness(4);
  }
}

.bar.hp>div {
  transition: width .7s ease-in-out, background-color .3s;
}

/* Capsule : lancer, secousses, capture ou évasion */
.capsule {
  position: absolute;
  z-index: 2;
  right: calc(clamp(16px, 5vw, 80px) + clamp(40px, 8vw, 90px));
  top: 22%;
  font-size: clamp(28px, 5vw, 44px);
  line-height: 1;
  filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .35));
}

.capsule.thrown {
  animation: capsule-throw .7s cubic-bezier(.3, .6, .4, 1) forwards;
}

@keyframes capsule-throw {
  0% {
    translate: -45vw 45vh;
    rotate: -540deg;
    scale: .6;
  }

  60% {
    translate: 0 -30px;
    rotate: 0deg;
    scale: 1.1;
  }

  100% {
    translate: 0 30px;
    scale: 1;
  }
}

.capsule.wobble {
  translate: 0 30px;
  animation: capsule-wobble .6s ease-in-out;
}

@keyframes capsule-wobble {
  25% {
    rotate: -25deg;
  }

  50% {
    rotate: 20deg;
  }

  75% {
    rotate: -10deg;
  }
}

.capsule.sealed {
  translate: 0 30px;
  animation: capsule-sealed .7s ease-out forwards;
}

@keyframes capsule-sealed {
  30% {
    filter: brightness(2) drop-shadow(0 0 16px var(--accent));
    scale: 1.2;
  }

  100% {
    scale: 1;
  }
}

.capsule.burst {
  translate: 0 30px;
  animation: capsule-burst .5s ease-out forwards;
}

@keyframes capsule-burst {
  to {
    scale: 2;
    opacity: 0;
    filter: brightness(3);
  }
}

/* Pierre-feuille-ciseaux : « Chi… fou… mi ! » */
@keyframes hand-shake {
  50% {
    translate: 0 -22px;
  }
}

@keyframes hand-win {
  50% {
    scale: 1.5;
  }
}

/* États durables d'un sprite : ils l'emportent sur les animations passagères (entrée, coup, soin). */
.arena .side .sprite.faint {
  animation: faint .8s forwards;
}

.arena .side .arena .side.mine .sprite.leave {
  animation: leave .7s ease-in forwards;
}

.arena .side.wild .sprite.leave {
  animation: leave-foe .7s ease-in forwards;
}

/* Le journal met en avant la dernière ligne. */
#battle .log p:not(:last-child) {
  opacity: .6;
}

/* =====================================================================
   Mobile : écrans tactiles et petits écrans
   ===================================================================== */
:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

#game {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

#game input {
  -webkit-user-select: text;
  user-select: text;
}

#hud-top {
  top: calc(12px + var(--safe-top));
  left: calc(12px + var(--safe-left));
}

#hud-actions {
  top: calc(12px + var(--safe-top));
  right: calc(12px + var(--safe-right));
}

/* Écran tactile : pas de raccourcis clavier, chat replié derrière 💬, croix directionnelle. */
.touch .touch-only {
  display: inline-flex !important;
}

.touch kbd,
.touch .hint-bubble {
  display: none;
}

.touch #chat {
  left: auto;
  right: calc(10px + var(--safe-right));
  bottom: calc(12px + var(--safe-bottom));
  width: min(280px, calc(100% - 230px));
  min-width: 150px;
  pointer-events: none;
}

.touch #chat-log {
  max-height: 96px;
  font-size: 12px;
  justify-items: end;
}

.touch #chat-input {
  display: none;
  pointer-events: auto;
}

.touch #chat.open {
  left: calc(10px + var(--safe-left));
  width: auto;
  z-index: 21;
}

.touch #chat.open #chat-input {
  display: block;
  font-size: 16px;
}

/* 16px : évite le zoom automatique d'iOS */
#dpad {
  left: calc(16px + var(--safe-left));
  right: auto;
  bottom: calc(16px + var(--safe-bottom));
  grid-template: repeat(3, 60px) / repeat(3, 60px);
  gap: 6px;
  z-index: 5;
}

#dpad button {
  font-size: 22px;
  border-radius: 16px;
  background: rgba(34, 27, 51, .72);
  backdrop-filter: blur(4px);
  box-shadow: 0 3px 0 rgba(0, 0, 0, .35);
}

#dpad button.held {
  background: var(--accent);
  color: var(--accent-ink);
}

#dpad button {
  pointer-events: none;
}

/* le doigt est suivi par la croix entière */
#dpad {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* Croix de fermeture : pastille rouge, repérable d'un coup d'œil. */
button.modal-close,
#team-close,
#dex-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  min-width: 38px;
  min-height: 38px;
  padding: 6px;
  border-radius: 12px;
  background: var(--danger);
  color: #fff;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .35), 0 0 0 2px rgba(255, 255, 255, .15);
}

button.modal-close:hover,
#team-close:hover,
#dex-close:hover {
  filter: brightness(1.12);
}

button.modal-close .icon,
#team-close .icon,
#dex-close .icon {
  width: 20px;
  height: 20px;
}

.touch #hud-actions button,
.touch .modal-close,
.touch #dex-close,
.touch #team-close {
  min-width: 44px;
  min-height: 44px;
  justify-content: center;
}

/* Barre d'outils : icônes seules dès que la place manque (tablettes, paysage). */
@media (max-width: 1200px),
(max-height: 500px) {

  #hud-actions .label,
  #hud-actions kbd {
    display: none;
  }

  #hud-actions button {
    padding: 8px 11px;
    font-size: 17px;
  }

  #hud-top {
    max-width: calc(100% - 140px);
  }
}

/* Petits écrans (téléphones en portrait) */
@media (max-width: 760px) {
  #hud-actions {
    right: calc(8px + var(--safe-right));
    top: calc(8px + var(--safe-top));
    gap: 6px;
  }

  #hud-actions .label,
  #hud-actions kbd {
    display: none;
  }

  #hud-actions button {
    padding: 8px 10px;
    font-size: 18px;
  }

  /* Les infos restent en haut : seul le bouton Menu est à côté. */
  #hud-top {
    top: calc(12px + var(--safe-top));
    left: calc(8px + var(--safe-left));
    max-width: calc(100% - 80px - var(--safe-left) - var(--safe-right));
    gap: 6px;
  }

  #hud-top>span {
    font-size: 12px;
    padding: 4px 10px;
  }

  #toast {
    top: calc(104px + var(--safe-top));
    font-size: 14px;
  }

  /* Fenêtres : presque tout l'écran, avec une marge pour voir qu'on est dans une fenêtre. */
  .modal-overlay,
  .dex-overlay {
    padding: calc(10px + var(--safe-top)) calc(10px + var(--safe-right)) calc(10px + var(--safe-bottom)) calc(10px + var(--safe-left));
  }

  /* Hauteur du contenu, sans dépasser l'écran : au-delà, toute la fenêtre défile. */
  .modal,
  .dex,
  .modal.help {
    width: 100%;
    height: auto;
    max-height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    grid-template-rows: none;
    align-content: start;
    border-radius: 16px;
    padding: 12px;
    gap: 12px;
  }

  /* Les zones qui défilaient seules suivent le défilement de la fenêtre. */
  .dex-body,
  .help-body {
    grid-template-rows: none;
    min-height: auto;
  }

  .dex-grid,
  .help-content {
    overflow: visible;
  }

  /* Fiche : l'en-tête ne porte que la croix, par-dessus l'image ; il reste transparent. */
  .modal.sheet > .modal-head {
    background: transparent;
    pointer-events: none;
  }

  .modal.sheet .modal-close {
    pointer-events: auto;
  }

  /* Un lien de la notice ne cache pas le début de la section sous l'en-tête. */
  .help-content section {
    scroll-margin-top: 72px;
  }

  /* L'en-tête (titre et croix) reste en haut quand le contenu défile. */
  .modal > .modal-head,
  .dex > .dex-head {
    position: sticky;
    top: -12px;
    z-index: 2;
    margin: -12px -12px 0;
    padding: 12px;
    background: var(--panel);
    border-radius: 16px 16px 0 0;
  }

  /* Cartes de monstre réduites à leur image : un appui ouvre la fiche, qui reprend les actions. */
  .mon-list {
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 6px;
  }

  .mon-card {
    grid-template-columns: 1fr;
    padding: 4px;
    border-radius: 10px;
  }

  .mon-card img {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
  }

  .mon-card .body,
  .mon-card .card-actions {
    display: none;
  }

  .modal-head h2,
  .dex-head h2 {
    font-size: 19px;
  }

  #team-panel {
    top: calc(10px + var(--safe-top));
    right: calc(10px + var(--safe-right));
    bottom: calc(10px + var(--safe-bottom));
    width: calc(100% - 20px - var(--safe-left) - var(--safe-right));
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 16px;
  }

  .invite {
    top: calc(110px + var(--safe-top));
    bottom: auto;
  }

  .ranking th,
  .ranking td {
    padding: 8px 6px;
  }

  .dex-grid {
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  }

  /* Fiche détaillée : plein écran à la demande plutôt qu'un panneau étroit. */
  .dex-body {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
  }

  .dex-detail {
    display: none;
  }

  .show-detail .dex-detail {
    display: grid;
    position: fixed;
    inset: calc(10px + var(--safe-top)) calc(10px + var(--safe-right)) calc(10px + var(--safe-bottom)) calc(10px + var(--safe-left));
    z-index: 26;
    max-height: none;
    border: 1px solid var(--line);
    border-radius: 16px;
    align-content: start;
    padding: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
  }

  .show-detail .dex-portrait {
    max-width: 260px;
    justify-self: center;
    width: 70%;
  }

  .dex-card img {
    width: 52px;
    height: 52px;
  }

  /* Combat */
  .arena {
    padding: 10px 12px;
  }

  .side {
    gap: 8px;
  }

  .side .info {
    width: min(300px, 54vw);
    padding: 8px 10px;
    gap: 4px;
  }

  .side .title {
    font-size: 14px;
  }

  .sprite {
    width: clamp(96px, 32vw, 200px);
    height: clamp(96px, 32vw, 200px);
  }

  .battle-banner {
    top: calc(8px + var(--safe-top));
    font-size: 13px;
  }

  #battle .arena {
    padding-top: calc(10px + var(--safe-top));
  }

  #battle .panel {
    padding: 10px 12px calc(12px + var(--safe-bottom));
    gap: 8px;
  }

  #battle .log {
    min-height: 64px;
    font-size: 14px;
  }

  #battle .other {
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  }

  #battle .other button {
    padding: 10px 4px;
    font-size: 13px;
  }

  .choice-list {
    grid-template-columns: 1fr;
  }

  .capsule {
    right: 18vw;
  }
}

/* Téléphones en paysage : peu de hauteur */
@media (max-height: 500px) and (orientation: landscape) {
  #battle {
    grid-template-rows: 1fr auto;
  }

  .arena {
    grid-template-rows: 1fr 1fr;
    padding: 6px clamp(16px, 6vw, 80px);
  }

  .sprite {
    width: 24vh;
    height: 24vh;
  }

  .side .info {
    padding: 6px 10px;
    gap: 3px;
  }

  #battle .panel {
    grid-template-columns: 1fr 1.2fr;
    align-items: center;
    padding: 8px calc(16px + var(--safe-right)) calc(8px + var(--safe-bottom)) calc(16px + var(--safe-left));
    gap: 8px 14px;
  }

  #battle .log {
    min-height: 0;
    font-size: 13px;
  }

  #battle .skip-hint {
    grid-column: 1;
  }

  #battle .actions,
  #battle .choice-list,
  #battle .waiting,
  #battle .continue {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  #battle .other {
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  }

  #battle .other button {
    padding: 6px 4px;
    font-size: 13px;
  }

  #hud-top {
    top: calc(10px + var(--safe-top));
  }

  #hud-actions {
    left: auto;
  }

  #dpad {
    grid-template: repeat(3, 52px) / repeat(3, 52px);
  }
}

/* ---------- Interactions (borne de soin, comptoir) ---------- */
.interact-prompt {
  position: fixed;
  left: 50%;
  bottom: calc(96px + var(--safe-bottom));
  translate: -50% 0;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(20, 16, 30, .88);
  color: var(--text);
  border: 2px solid var(--accent);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
}

.interact-prompt.pop {
  animation: pop-in .25s ease-out;
}

.interact-prompt kbd {
  opacity: 1;
  margin: 0;
  padding: 2px 8px;
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  font-weight: 800;
}

.interact-text {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.interact-icon {
  font-size: 18px;
}

.touch-key {
  display: none;
}

/*
 * Sur mobile : boutons A et B toujours affichés à droite, comme sur une manette (A plus haut, B à sa gauche).
 * A s'allume quand une action est possible ; ce qu'elle fait s'écrit en petit juste au-dessus.
 */
.touch .interact-prompt {
  left: auto;
  right: calc(18px + var(--safe-right));
  bottom: calc(64px + var(--safe-bottom));
  translate: none;
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
  -webkit-touch-callout: none;
  user-select: none;
}

.touch .interact-prompt kbd,
.touch .interact-icon {
  display: none;
}

.touch .interact-text {
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  /* Jamais sur la croix directionnelle (à gauche, 3 × 60 px + marges). */
  max-width: calc(100vw - 240px - var(--safe-left) - var(--safe-right));
  width: max-content;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  text-align: right;
  color: rgba(255, 255, 255, .8);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .9);
  pointer-events: none;
}

.touch .touch-key,
.run-button {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  font-size: 22px;
  font-weight: 900;
}

/* A au repos : discret, comme B */
.touch .touch-key,
.run-button {
  background: rgba(34, 27, 51, .75);
  color: var(--muted);
  border: 2px solid var(--line);
  box-shadow: 0 3px 0 rgba(0, 0, 0, .35);
}

/* A quand une action est possible : en surbrillance */
.touch .interact-prompt.ready .touch-key {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  box-shadow: 0 3px 0 rgba(0, 0, 0, .35), 0 0 16px color-mix(in srgb, var(--accent) 70%, transparent);
}

.run-button {
  position: fixed;
  right: calc(86px + var(--safe-right));
  bottom: calc(20px + var(--safe-bottom));
  z-index: 6;
  padding: 0;
  touch-action: none;
  -webkit-touch-callout: none;
  user-select: none;
}

.run-button.held {
  background: var(--xp);
  color: #0b1a2a;
  border-color: var(--xp);
}

/* Très petits écrans : A et B plus petits pour laisser la place à la croix. */
@media (max-width: 350px) {
  .touch .touch-key,
  .run-button {
    width: 48px;
    height: 48px;
    font-size: 19px;
  }

  .touch .interact-prompt {
    right: calc(12px + var(--safe-right));
    bottom: calc(58px + var(--safe-bottom));
  }

  .run-button {
    right: calc(68px + var(--safe-right));
  }
}

.touch #chat {
  bottom: calc(100px + var(--safe-bottom));
}

.heal-flash {
  position: fixed;
  inset: 0;
  z-index: 7;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255, 143, 181, .75), rgba(255, 143, 181, 0) 70%);
}

.heal-flash.flashing {
  animation: heal-flash 1.2s ease-out forwards;
}

@keyframes heal-flash {
  0% {
    opacity: 0;
  }

  20% {
    opacity: 1;
  }

  45% {
    opacity: .3;
  }

  65% {
    opacity: .9;
  }

  100% {
    opacity: 0;
  }
}

/* ---------- Dialogues ---------- */
.dialogue {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 24;
  display: grid;
  justify-items: center;
  padding: 0 12px calc(16px + var(--safe-bottom));
  pointer-events: none;
}

.dialogue-box {
  position: relative;
  pointer-events: auto;
  cursor: pointer;
  width: min(760px, 100%);
  min-height: 112px;
  background: #fbf8f0;
  color: #1d1a24;
  border: 4px solid #2d2442;
  border-radius: 16px;
  padding: 14px 18px 18px;
  box-shadow: 0 0 0 3px #fbf8f0, 0 12px 40px rgba(0, 0, 0, .45);
  animation: pop-in .2s ease-out;
}

.dialogue-speaker {
  position: absolute;
  top: -16px;
  left: 16px;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 2px 12px;
  border-radius: 999px;
  font-size: 14px;
  border: 3px solid #2d2442;
}

.dialogue-text {
  margin: 6px 0 0;
  font-size: 17px;
  line-height: 1.5;
  min-height: 2.8em;
  white-space: pre-wrap;
}

.dialogue-next {
  position: absolute;
  right: 16px;
  bottom: 8px;
  color: #2d2442;
  animation: bob .8s ease-in-out infinite;
}

@keyframes bob {
  50% {
    translate: 0 4px;
  }
}

.dialogue-choices {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 10px;
  flex-wrap: wrap;
}

.dialogue-choices button.selected {
  outline: 3px solid #2d2442;
  outline-offset: 2px;
}

.touch .dialogue {
  padding-bottom: calc(12px + var(--safe-bottom));
}

@media (max-width: 760px) {
  .dialogue-text {
    font-size: 16px;
  }
}

/* ---------- Journal de quêtes ---------- */
.quest-list {
  display: grid;
  gap: 10px;
}

.quest-entry {
  display: grid;
  gap: 6px;
  background: var(--panel-2);
  border-radius: 12px;
  padding: 12px 14px;
  border-left: 4px solid var(--accent);
}

.quest-entry.done {
  border-left-color: var(--hp);
  opacity: .75;
}

.quest-entry header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.quest-entry p {
  margin: 0;
  color: var(--text);
}

.quest-entry small {
  color: var(--muted);
}

.quest-count {
  color: var(--accent);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.quest-bar>div {
  background: var(--accent);
}

/* ---------- Badges ---------- */
.arena-badge {
  --c: #ffd640;
  position: absolute;
  left: 50%;
  top: 45%;
  z-index: 4;
  translate: -50% -50%;
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  font-size: 48px;
  background: radial-gradient(circle at 35% 30%, #fff8, transparent 60%), var(--c);
  border: 4px solid #fff;
  box-shadow: 0 0 0 4px var(--c), 0 0 40px var(--c);
  animation: badge-spin 1.2s cubic-bezier(.2, .8, .3, 1.2);
}

@keyframes badge-spin {
  from {
    scale: 0;
    rotate: -540deg;
  }

  to {
    scale: 1;
    rotate: 0deg;
  }
}

/* Cérémonie de remise de badge */
.badge-ceremony {
  background: radial-gradient(circle, #3a5a2a, #0b0914 70%);
}

.ceremony-badge {
  --c: #ffd640;
  display: grid;
  place-items: center;
  width: clamp(140px, 30vw, 200px);
  aspect-ratio: 1;
  border-radius: 50%;
  font-size: clamp(64px, 14vw, 100px);
  background: radial-gradient(circle at 35% 30%, #fff9, transparent 55%), var(--c);
  border: 6px solid #fff;
  box-shadow: 0 0 0 6px var(--c), 0 0 60px var(--c);
}

.badge-ceremony.celebrating .ceremony-badge {
  animation: badge-spin 1.4s cubic-bezier(.2, .8, .3, 1.2), badge-glow 2s ease-in-out 1.4s infinite;
}

@keyframes badge-glow {
  50% {
    box-shadow: 0 0 0 6px var(--c), 0 0 100px var(--c);
  }
}

.ceremony-description {
  margin: -8px 0 0;
  color: #d8d2e8;
  max-width: 480px;
}

/* Vitrine des badges (panneau d'équipe) */
.badge-case {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.badge-slot {
  --c: #555;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  font-size: 26px;
  background: radial-gradient(circle at 35% 30%, #fff6, transparent 55%), var(--c);
  border: 3px solid #fff;
  box-shadow: 0 0 0 3px var(--c);
}

.badge-slot.locked {
  background: var(--panel-2);
  border-color: var(--line);
  box-shadow: none;
  color: var(--muted);
  font-size: 20px;
}

.badge-count {
  color: var(--muted);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}

.quest-objective {
  font-weight: 600;
}

/* Choix du monstre de départ */
.starter-overlay {
  z-index: 40;
}

.modal.starter {
  width: min(820px, 100%);
}

.starter-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.starter-card {
  display: grid;
  justify-items: center;
  gap: 6px;
  text-align: center;
  padding: 14px;
  background: var(--panel-2);
  color: var(--text);
  border: 2px solid transparent;
  border-radius: 14px;
  font-weight: 400;
}

.starter-card img {
  width: 112px;
  height: 112px;
  object-fit: contain;
  image-rendering: pixelated;
  transition: transform .2s;
}

.starter-card strong {
  font-size: 18px;
}

.starter-card p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.starter-card .badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.starter-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 214, 64, .25), 0 3px 0 rgba(0, 0, 0, .35);
}

.starter-card.selected img {
  transform: scale(1.12) translateY(-4px);
}

.starter-confirm {
  justify-self: center;
  min-width: 220px;
}

/* Ordre de l'équipe et PC de stockage */
.team-hint,
.box-info {
  margin: 0 0 8px;
  font-size: 12px;
}

.box-info {
  margin-top: 12px;
}

.mon-card[draggable=true] {
  cursor: grab;
}

.mon-card.dragging {
  opacity: .45;
}

.mon-card.drop-target {
  outline: 2px dashed var(--accent);
  outline-offset: 2px;
}

.modal.storage {
  width: min(980px, 100%);
}

.storage-columns {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: start;
}

.storage-columns h3 {
  margin: 0 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}

@media (max-width: 700px) {
  .storage-columns {
    grid-template-columns: 1fr;
  }
}

/* Fiche d'un monstre */
.sheet-overlay {
  z-index: 30;
}

.modal.sheet {
  width: min(560px, 100%);
  gap: 12px;
}

.modal.sheet .modal-head {
  margin-bottom: -40px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.sheet-head {
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 14px;
  align-items: center;
}

.sheet-image {
  width: 128px;
  height: 128px;
  object-fit: contain;
  image-rendering: pixelated;
  background: var(--panel-2);
  border-radius: 14px;
}

.sheet-id h2 {
  margin: 0;
  font-size: 22px;
}

.sheet-id p {
  margin: 2px 0 6px;
}

.sheet-id .badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.sheet-field {
  display: grid;
  gap: 2px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.sheet-rename {
  font: inherit;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
}

.sheet-bars {
  display: grid;
  gap: 4px;
}

.bar.xp>div {
  background: var(--xp);
}

.sheet-stats table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.sheet-stats th,
.sheet-stats td {
  padding: 5px 6px;
  text-align: right;
  border-bottom: 1px solid var(--line);
}

.sheet-stats th:first-child {
  text-align: left;
}

.sheet-stats thead th {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

.sheet-stats td.total {
  font-weight: 800;
  font-size: 16px;
}

.sheet-stats td.bonus {
  color: var(--hp);
}

.sheet-stats td.bonus>div {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.bonus-meter {
  width: 60px;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, .1);
  overflow: hidden;
}

.bonus-meter i {
  display: block;
  height: 100%;
  background: var(--hp);
}

.sheet-potential {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.sheet-potential .stars {
  color: var(--accent);
  letter-spacing: 2px;
}

.sheet-info {
  margin: 0;
  font-size: 13px;
}

.sheet-items h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.sheet-item-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sheet-item-list small {
  opacity: .8;
  font-weight: 500;
}

.mon-card.openable {
  cursor: pointer;
}

.mon-card.openable:hover {
  outline: 1px solid var(--line);
}

.modal .hint {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

.sheet-follow {
  display: flex;
}

/* Attaques en combat */
#battle .moves {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

#battle .moves button {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2px 8px;
  text-align: left;
  padding: 9px 12px;
  background: color-mix(in srgb, var(--c, var(--accent)) 30%, var(--panel-2));
  color: var(--text);
  border-left: 5px solid var(--c, var(--accent));
}

#battle .moves button strong {
  font-size: 15px;
}

#battle .moves button small {
  color: var(--muted);
  font-size: 11px;
}

#battle .moves button .pp {
  grid-row: span 2;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--text);
  opacity: .85;
}

#battle .moves button.empty-pp .pp {
  color: var(--danger);
}

#battle .moves .struggle {
  grid-column: 1 / -1;
}

#battle .info .status {
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--c);
  color: #111;
  margin-left: 4px;
}

#battle .sprite.attack-ally {
  animation: attack-ally .38s ease-out;
}

#battle .sprite.attack-foe {
  animation: attack-foe .38s ease-out;
}

@keyframes attack-ally {
  40% {
    translate: 18% -12%;
    filter: drop-shadow(0 0 10px var(--move-color));
  }
}

@keyframes attack-foe {
  40% {
    translate: -18% 12%;
    filter: drop-shadow(0 0 10px var(--move-color));
  }
}

@media (max-width: 520px) {
  #battle .moves button {
    padding: 7px 8px;
  }

  #battle .moves button strong {
    font-size: 13px;
  }
}

/* Attaques dans la fiche */
.sheet-moves-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.sheet-moves-head h3 {
  margin: 0;
  font-size: 14px;
  flex: 1;
}

.sheet-moves-head button {
  padding: 5px 10px;
  font-size: 13px;
}

.move-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.move-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 6px;
  text-align: left;
  padding: 7px 9px;
  border-radius: 10px;
  font-weight: 500;
  background: color-mix(in srgb, var(--c) 18%, var(--panel-2));
  color: var(--text);
  border: 2px solid transparent;
  border-left: 5px solid var(--c);
  box-shadow: none;
}

.move-card strong {
  font-size: 14px;
}

.move-card .move-pp {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.move-card small {
  grid-column: 1 / -1;
  font-size: 11px;
  color: var(--muted);
}

button.move-card.selected {
  border-color: var(--accent);
  border-left-color: var(--c);
}

@media (max-width: 520px) {
  .move-grid {
    grid-template-columns: 1fr;
  }
}

/* Efficacité des attaques contre le monstre d'en face */
#battle .moves button {
  position: relative;
}

#battle .moves .efficacy {
  grid-column: 1 / -1;
  justify-self: start;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 6px;
  margin-top: 2px;
}

#battle .moves button.strong .efficacy {
  background: #22c55e;
  color: #052e14;
}

#battle .moves button.weak .efficacy {
  background: #ef4444;
  color: #fff;
}

#battle .moves button.neutral .efficacy {
  background: rgba(255, 255, 255, .14);
  color: var(--text);
}

#battle .moves button.strong:not(:disabled) {
  box-shadow: 0 0 0 2px #22c55e inset, 0 3px 0 rgba(0, 0, 0, .35);
}

/* Énergie en combat */
#battle .bar.energy {
  height: 5px;
  margin-top: 3px;
}

#battle .bar.energy>div {
  background: linear-gradient(90deg, #facc15, #fde68a);
  transition: width .4s;
}

#battle .energytext {
  display: block;
  font-size: 11px;
  color: #a16207;
  font-weight: 700;
  text-align: right;
}

#battle .moves .rest {
  grid-column: 1 / -1;
  --c: #94a3b8;
}

/* Fiche d'un monstre : onglets */
.sheet-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.sheet-tabs button {
  margin: 12px 0px;
  padding: 8px 6px;
  font-size: 13px;
}

.sheet-tab {
  display: grid;
  gap: 12px;
  align-content: start;
}

.sheet-id .sheet-bars {
  margin-top: 6px;
}

@media (max-width: 520px) {
  .sheet-head {
    grid-template-columns: 84px 1fr;
    gap: 10px;
  }

  .sheet-image {
    width: 84px;
    height: 84px;
  }

  .sheet-id h2 {
    font-size: 18px;
  }
}
/* Choix de l'apparence */
#btn-appearance {
  margin: 0 8px 0 auto;
  padding: 6px 10px;
  font-size: 13px;
}

.modal.appearance {
  width: min(640px, 100%);
}

.appearance-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.appearance-card {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 10px;
  background: var(--panel-2);
  color: var(--text);
  border: 2px solid transparent;
  border-radius: 14px;
  font-weight: 400;
}

.appearance-card canvas,
.appearance-classic {
  width: 96px;
  height: 96px;
}

.appearance-classic {
  display: grid;
  place-items: center;
  font-size: 44px;
}

.appearance-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 214, 64, .25);
}

/* Icônes (voir public/assets/icons) */
.stars .icon.star-off { opacity: .25; }
.appearance-classic .icon { width: 56px; height: 56px; }
.shop-icon .icon { width: 36px; height: 36px; }
/* Image téléversée d'un objet : occupe la place d'une icône. */
.item-image { display: inline-block; flex: none; width: 1.2em; height: 1.2em; vertical-align: -0.22em; object-fit: contain; image-rendering: pixelated; }
.shop-icon .item-image { width: 36px; height: 36px; }
.capsule .item-image { width: 100%; height: 100%; }
.shop-empty { color: var(--muted); text-align: center; padding: 16px; margin: 0; }
.capsule .icon { width: 100%; height: 100%; }
.side .name .caught-mark { width: .9em; height: .9em; vertical-align: -0.1em; }
.arena-badge .icon, .ceremony-badge .icon, .badge-slot .icon { width: .9em; height: .9em; vertical-align: -0.1em; }
button.icon > .icon { vertical-align: middle; }
#dpad button .icon { width: 26px; height: 26px; }

/* ---------- Carte du monde ---------- */
.modal.world-map {
  width: min(900px, 100%);
}

.world-map-frame {
  position: relative;
  margin-inline: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.world-map-drawing {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.world-map-areas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  pointer-events: none;
}

.world-map-player {
  position: absolute;
  translate: -50% -50%;
  border-radius: 50%;
  width: 14px;
  height: 14px;
  /* Rouge sur contour blanc : se détache de la zone surlignée en jaune. */
  background: #ff4d6d;
  border: 2px solid #fff;
  animation: world-map-pulse 1.4s ease-out infinite;
}

@keyframes world-map-pulse {
  from { box-shadow: 0 0 0 0 rgb(255 77 109 / .8); }
  to { box-shadow: 0 0 0 14px rgb(255 77 109 / 0); }
}

@media (prefers-reduced-motion: reduce) {
  .world-map-player { animation: none; }
}

/* Actions de la carte d'où la fiche a été ouverte (équipe, boîte, soin…) */
.sheet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sheet-actions button {
  padding: 8px 12px;
  font-size: 14px;
}

/* PC : équipe et boîte en cases */
.storage-box-head,
.storage-sort-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.storage-box-head {
  margin-bottom: 8px;
}

.storage-box-head .storage-box-count {
  margin: 0 0 0 auto;
}

.storage-sort-row {
  margin-top: 10px;
}

.storage-sort {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.storage-sort select {
  width: auto;
  padding: 6px 8px;
}

.storage-box-head button.icon,
button.storage-sort-dir {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
  padding: 6px;
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
}

.slot-grid {
  display: grid;
  gap: 6px;
}

.storage-team {
  grid-template-columns: repeat(2, 64px);
}

.storage-box {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.slot {
  position: relative;
  aspect-ratio: 1;
  min-width: 0;
  border-radius: 10px;
  background: rgba(0, 0, 0, .25);
  border: 1px dashed var(--line);
}

.slot.drop-target {
  border: 2px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 15%, transparent);
}

.slot-monster {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 2px;
  border-radius: 9px;
  background: var(--panel-2);
  box-shadow: none;
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.slot-monster img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.slot-monster.lifted {
  opacity: .3;
}

.slot-level {
  position: absolute;
  right: 3px;
  bottom: 2px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 6px;
  background: rgba(0, 0, 0, .55);
  color: var(--text);
}

.slot-shiny {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  color: #ffe27a;
}

/* Monstre soulevé : il suit le pointeur */
.slot-ghost {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  width: 64px;
  height: 64px;
  padding: 4px;
  border-radius: 12px;
  border: 2px solid var(--accent);
  background: var(--panel-2);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  pointer-events: none;
}

.slot-ghost img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

@media (max-width: 700px) {
  .storage-team {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

/* Fiche : passer au monstre voisin */
.sheet-browse {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.sheet-browse button {
  min-width: 44px;
  min-height: 40px;
  padding: 6px 10px;
}

/* ---------- Menu du jeu ---------- */
#btn-menu.active {
  background: var(--accent);
  color: var(--accent-ink);
}

.hud-menu {
  position: fixed;
  top: calc(62px + var(--safe-top));
  right: calc(12px + var(--safe-right));
  z-index: 21;
  width: min(580px, calc(100vw - 24px - var(--safe-left) - var(--safe-right)));
  max-height: calc(100vh - 80px - var(--safe-top) - var(--safe-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
  display: grid;
  gap: 12px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .55);
  animation: pop-in .18s ease-out;
}

.hud-menu-grid,
.hud-menu-footer {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.hud-menu-footer {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

button.hud-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 68px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--panel-2);
  color: var(--text);
  text-align: left;
  box-shadow: none;
}

button.hud-menu-item:hover {
  filter: brightness(1.15);
}

.hud-menu-item > .icon {
  flex: none;
  width: 28px;
  height: 28px;
}

.hud-menu-text {
  display: grid;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.hud-menu-text strong {
  font-size: 16px;
}

.hud-menu-text small {
  font-size: 12px;
  font-weight: 400;
  line-height: 1.25;
  color: var(--muted);
}

.hud-menu-item kbd {
  flex: none;
  margin-left: auto;
}

button.hud-menu-item.primary {
  background: var(--accent);
  color: var(--accent-ink);
}

button.hud-menu-item.primary small {
  color: rgba(42, 33, 0, .75);
}

button.hud-menu-item.danger {
  background: color-mix(in srgb, var(--danger) 16%, var(--panel-2));
  color: var(--text);
}

button.hud-menu-item.danger > .icon {
  color: var(--danger);
}

@media (max-width: 760px) {
  .hud-menu {
    top: calc(60px + var(--safe-top));
    right: calc(10px + var(--safe-right));
    width: calc(100vw - 20px - var(--safe-left) - var(--safe-right));
    padding: 12px;
  }

  button.hud-menu-item {
    gap: 10px;
    min-height: 64px;
    padding: 10px 12px;
  }

  .hud-menu-text strong {
    font-size: 15px;
  }
}

@media (max-width: 340px) {
  .hud-menu-grid {
    grid-template-columns: 1fr;
  }
}

/* Classement : progression générale */
.ranking-progress {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
}

.ranking-bar {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .4);
  overflow: hidden;
}

.ranking-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.ranking-progress b {
  min-width: 3.2em;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Inspecter un autre dresseur : son équipe */
.inspect-team {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.inspect-card {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 12px;
  background: var(--panel-2);
}

.inspect-card img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: 10px;
  background: rgba(0, 0, 0, .2);
}

.inspect-body {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.inspect-body small {
  margin: 0;
}
