:root {
  --bg: #ece8d9;
  --surface: #faf8f2;
  --surface-alt: #f2eee2;
  --surface-card: #f7f4eb;
  --border: #1e1e1e;
  --text: #1a1a1a;
  --text-muted: #524d42;
  --sloche-red: #c82018;
  --sloche-red-dark: #a31610;
  --btn-secondary: #d6d1c2;
  --btn-secondary-hover: #c5bfb0;
  --chat-bg: #dcd7c9;
  --console-bg: #1e1e1e;
  --success: #15803d;
  --warning: #b45309;
  --in-color: #38bdf8;
  --out-color: #c084fc;
  --radius: 6px;
  --shadow-hard: 3px 3px 0 #1e1e1e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Segoe UI", Tahoma, sans-serif;
  background-color: var(--bg);
  background-image: radial-gradient(rgba(30, 30, 30, 0.06) 1px, transparent 1px);
  background-size: 14px 14px;
  color: var(--text);
  line-height: 1.4;
}

.app-shell {
  max-width: min(1480px, 95vw);
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100vh;
}

/* Bandeau supérieur Sloche */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 11px 16px;
  background: linear-gradient(180deg, var(--sloche-red) 0%, var(--sloche-red-dark) 100%);
  border: 2px solid #111111;
  border-radius: var(--radius);
  box-shadow: var(--shadow-hard);
  color: #ffffff;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.brand-title {
  font-size: 1.5rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #ffffff;
  text-shadow: 2px 2px 0 #111111;
}

.brand-subtitle {
  font-size: 0.82rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(17, 17, 17, 0.28);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(17, 17, 17, 0.45);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 0.84rem;
  font-weight: 800;
  border: 2px solid #111111;
  background: #faf8f2;
  color: #111111;
  box-shadow: 2px 2px 0 #111111;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid #111111;
  background: #9ca3af;
}

.status-disconnected .status-dot {
  background: var(--sloche-red);
}

.status-connecting .status-dot {
  background: #f59e0b;
  animation: pulse 1.1s infinite ease-in-out;
}

.status-connected .status-dot {
  background: #22c55e;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* Cartes & Panneaux */
.card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-hard);
}

.connection-panel {
  background: #ffffff;
}

.connection-form {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 180px;
}

.field-small {
  flex: 0 1 130px;
}

.field label {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text);
}

.field input {
  background: #ffffff;
  border: 2px solid var(--border);
  border-radius: 4px;
  padding: 7px 10px;
  color: #111111;
  font-size: 0.92rem;
  font-weight: 600;
  outline: none;
}

.field input:focus {
  border-color: var(--sloche-red);
  box-shadow: 0 0 0 2px rgba(200, 32, 24, 0.2);
}

.actions {
  display: flex;
  gap: 8px;
}

/* Boutons style Flash rétro */
.btn {
  border: 2px solid #111111;
  border-radius: 4px;
  padding: 8px 15px;
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 2px 2px 0 #111111;
  transition: transform 0.08s ease, box-shadow 0.08s ease, background-color 0.12s ease;
}

.btn:active:not(:disabled) {
  transform: translate(1px, 2px);
  box-shadow: 0 0 0 #111111;
}

.btn-primary {
  background: linear-gradient(180deg, var(--sloche-red) 0%, var(--sloche-red-dark) 100%);
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.btn-primary:hover:not(:disabled) {
  background: var(--sloche-red-dark);
}

.btn-danger {
  background: #2b2b2b;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.btn-danger:hover:not(:disabled) {
  background: #111111;
}

.btn-ghost {
  background: var(--btn-secondary);
  color: #1a1a1a;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--btn-secondary-hover);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.76rem;
}

.btn-xs {
  padding: 3px 8px;
  font-size: 0.72rem;
}

.status-detail {
  margin: 9px 0 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Grille principale (3 colonnes : Joueurs | Chat | Carte) */
.workspace-grid {
  display: grid;
  grid-template-columns: 270px 1fr 310px;
  grid-template-rows: minmax(480px, 540px);
  gap: 16px;
}

.players-panel {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-panel {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.map-panel {
  grid-column: 3;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.map-panel .panel-header h2 {
  white-space: nowrap;
}

.console-panel {
  display: flex;
  flex-direction: column;
}

.console-header-clickable {
  cursor: pointer;
  user-select: none;
}

.console-panel.console-collapsed .panel-header {
  margin-bottom: -14px;
  border-bottom: none;
  border-radius: 4px;
}

.console-panel.console-collapsed .xml-console {
  display: none;
}

.console-panel.console-collapsed .checkbox-label,
.console-panel.console-collapsed #clearConsoleBtn {
  display: none;
}

.console-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.console-chevron {
  font-size: 0.78rem;
  line-height: 1;
}

/* En-têtes rouges Sloche des panneaux */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: -14px -16px 12px;
  padding: 8px 14px;
  background: linear-gradient(180deg, var(--sloche-red) 0%, var(--sloche-red-dark) 100%);
  border-bottom: 2px solid var(--border);
  border-radius: 4px 4px 0 0;
  color: #ffffff;
}

.panel-header h2 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-shadow: 1px 1px 0 #111111;
}

.panel-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-header .btn-ghost {
  background: #ebe6d8;
  color: #111111;
  border-width: 1.5px;
  box-shadow: 1px 1px 0 #111111;
}

.panel-header .btn-ghost:hover:not(:disabled) {
  background: #ffffff;
}

.panel-header .btn-primary {
  background: #1e1e1e;
  border-color: #111111;
}

.panel-header .btn-primary:hover:not(:disabled) {
  background: #000000;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #ffffff;
  cursor: pointer;
}

.pill {
  background: #ffffff;
  color: #111111;
  border: 1.5px solid #111111;
  border-radius: 4px;
  padding: 1px 8px;
  font-size: 0.76rem;
  font-weight: 800;
}

/* Liste des joueurs dans la salle */
.players-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.player-item {
  background: var(--surface-card);
  border: 1.5px solid var(--border);
  border-radius: 5px;
  padding: 5px 8px;
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.player-item:hover {
  filter: brightness(0.98);
}

.player-item-self {
  border: 2px solid var(--sloche-red);
  background: #fff2f0;
}

.player-item-following {
  border: 2px solid var(--success);
  background: #ecfdf5;
}

.player-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.player-badges-wrap {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.player-follow-indicator {
  font-size: 0.72rem;
  line-height: 1;
  padding: 1px 4px;
  border-radius: 3px;
  background: #dcfce7;
  border: 1px solid #15803d;
}

.player-chevron {
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1;
}

.player-details {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.18s ease, opacity 0.15s ease, margin-top 0.15s ease;
}

.player-item.expanded .player-details {
  max-height: 120px;
  opacity: 1;
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px dashed rgba(30, 30, 30, 0.25);
}

.player-name-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.player-color-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid #111111;
  flex-shrink: 0;
}

.afk-tag {
  font-weight: 800;
  color: #a16207;
  margin-left: 4px;
}

.player-last-activity {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  line-height: 1.25;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-badge {
  font-size: 10px;
  font-weight: 800;
  line-height: 1.15;
  padding: 0 4px;
  border: 1px solid #1e1e1e;
  border-radius: 3px;
  background: #e5e0d3;
  color: #111111;
  letter-spacing: 0.1px;
}

.player-name {
  font-weight: 800;
  color: #111111;
  word-break: break-word;
}

.player-coords {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--text-muted);
}

.player-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
}

.player-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  font-size: 0.76rem;
  line-height: 1.2;
  border-radius: 4px;
  border: 1.5px solid #1e1e1e;
  background: var(--btn-secondary);
  color: #111111;
  cursor: pointer;
  transition: background-color 0.1s ease, transform 0.08s ease;
}

.player-action-btn:hover:not(:disabled) {
  background: #ffffff;
}

.player-action-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.player-action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.player-action-btn.active {
  border-color: #111111;
  background: #22c55e;
  color: #111111;
}

.bot-badge {
  font-size: 0.65rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--sloche-red);
  color: #ffffff;
  border: 1.5px solid #111111;
  flex-shrink: 0;
}

/* Fenêtre Chat en direct (BT) style client Flash */
.scroll-feed {
  border: 2px solid var(--border);
  border-radius: 5px;
  padding: 8px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.chat-feed {
  background: var(--chat-bg);
}

.chat-feed .empty-state {
  color: var(--text-muted);
}

.chat-entry {
  font-size: 0.88rem;
  word-break: break-word;
  padding: 5px 9px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.92);
  border: 1.5px solid #1e1e1e;
  border-left-width: 4px;
  color: #111111;
}

.chat-entry-self {
  border-color: var(--sloche-red);
}

.bot-badge-inline {
  margin-right: 6px;
  vertical-align: middle;
}

.chat-time {
  color: #524d42;
  font-size: 0.75rem;
  font-weight: 700;
  margin-right: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.chat-author {
  font-weight: 800;
  color: var(--sloche-red);
  margin-right: 5px;
}

.chat-system {
  font-size: 0.78rem;
  font-style: italic;
  font-weight: 700;
  color: #faf8f2;
  background: rgba(17, 17, 17, 0.42);
  border-radius: 4px;
  padding: 3px 8px;
}

.chat-input-bar {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.chat-input-bar input {
  flex: 1;
  background: #ffffff;
  border: 2px solid var(--border);
  border-radius: 4px;
  padding: 8px 11px;
  color: #111111;
  font-size: 0.9rem;
  font-weight: 600;
  outline: none;
}

.chat-input-bar input:focus {
  border-color: var(--sloche-red);
}

.chat-input-bar input:disabled,
.chat-input-bar button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-sound.sound-muted {
  opacity: 0.75;
}

/* Console XML brute (fond sombre contrasté) */
.xml-console {
  background: var(--console-bg);
  color: #e2e8f0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.79rem;
  height: 280px;
  flex: none;
}

.xml-console .empty-state {
  color: #94a3b8;
}

.xml-entry {
  display: flex;
  gap: 8px;
  align-items: baseline;
  word-break: break-all;
}

.xml-dir {
  font-weight: 800;
  flex-shrink: 0;
  font-size: 0.72rem;
  padding: 1px 6px;
  border-radius: 3px;
}

.xml-dir-in {
  color: var(--in-color);
  background: rgba(56, 189, 248, 0.14);
}

.xml-dir-out {
  color: var(--out-color);
  background: rgba(192, 132, 252, 0.14);
}

.xml-dir-err {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.22);
}

.empty-state {
  color: var(--text-muted);
  font-size: 0.84rem;
  font-style: italic;
}

/* Panneau Apparence du Bot */
.appearance-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.appearance-header {
  flex-wrap: wrap;
}

.appearance-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.appearance-status {
  font-size: 0.74rem;
  font-weight: 800;
  color: #111111;
  background: #faf8f2;
  border: 1.5px solid #111111;
  border-radius: 4px;
  padding: 2px 8px;
  text-transform: none;
}

.appearance-status-ok {
  background: #dcfce7;
  color: #14532d;
}

.appearance-status-error {
  background: #fee2e2;
  color: #7f1d1d;
}

.appearance-status-warn {
  background: #fef3c7;
  color: #78350f;
}

.appearance-layout {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 14px;
  align-items: start;
}

.appearance-preview-card {
  background: var(--surface-card);
  border: 2px solid var(--border);
  border-radius: 5px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.preview-title {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #111111;
  text-align: center;
}

.mannequin-stage {
  min-height: 210px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 6px;
  background-color: #e2ddd0;
  background-image:
    linear-gradient(45deg, rgba(30, 30, 30, 0.05) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(30, 30, 30, 0.05) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(30, 30, 30, 0.05) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(30, 30, 30, 0.05) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  border-radius: 5px;
  border: 2px solid var(--border);
}

.mannequin-layer {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
}

.mannequin-layer img {
  display: block;
  width: auto;
  height: auto;
  object-fit: contain;
  background: transparent;
}

.mannequin-layer-tete {
  z-index: 3;
}

.mannequin-layer-tete img {
  max-width: 96px;
  max-height: 72px;
}

.mannequin-layer-corps {
  margin-top: -18px;
  z-index: 2;
}

.mannequin-layer-corps img {
  max-width: 96px;
  max-height: 76px;
}

.mannequin-layer-pied {
  margin-top: -18px;
  z-index: 1;
}

.mannequin-layer-pied img {
  max-width: 82px;
  max-height: 68px;
}

.mannequin-summary {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.clone-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 8px;
  border-top: 1.5px solid var(--border);
}

.clone-label {
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #111111;
}

.clone-controls {
  display: flex;
  gap: 6px;
}

.clone-select {
  flex: 1;
  min-width: 0;
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  padding: 5px 7px;
  color: #111111;
  font-size: 0.78rem;
  font-weight: 600;
}

.clone-select:disabled,
.clone-controls button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.appearance-parts-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.part-column {
  background: var(--surface-card);
  border: 2px solid var(--border);
  border-radius: 5px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.part-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 6px;
  border-bottom: 1.5px solid var(--border);
}

.part-title {
  font-size: 0.9rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #111111;
}

.color-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.color-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
}

.color-row input[type="color"] {
  width: 34px;
  height: 26px;
  padding: 0;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
}

.color-readout {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}

.color-presets-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}

.color-swatches {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.swatch-btn {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  border: 1.5px solid #111111;
  padding: 0;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.swatch-btn:hover {
  transform: scale(1.15);
}

.part-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
}

.part-tile {
  position: relative;
  height: 48px;
  background: #e9e4d7;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  padding: 6px 3px 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #111111;
  transition: border-color 0.1s ease, background-color 0.1s ease;
}

.part-tile:hover {
  background: #ffffff;
}

.part-tile.selected {
  border: 2px solid var(--sloche-red);
  background: #fce8e6;
  box-shadow: 0 0 0 1px var(--sloche-red);
}

.part-tile img {
  max-width: 100%;
  max-height: 34px;
  object-fit: contain;
  background: transparent;
}

.part-tile-fallback {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}

.part-tile-invisible {
  font-size: 0.6rem;
  font-weight: 800;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.1;
}

.part-tile-id {
  position: absolute;
  top: 2px;
  left: 3px;
  font-size: 0.58rem;
  font-weight: 800;
  line-height: 1;
  padding: 1px 3px;
  border-radius: 2px;
  background: #1e1e1e;
  color: #ffffff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  pointer-events: none;
}

/* Générateur de Bookmarklet */
.bookmarklet-box {
  background: var(--surface-card);
  border: 2px solid var(--border);
  border-radius: 5px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bookmarklet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.bookmarklet-title {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--sloche-red);
}

.bookmarklet-hint {
  font-size: 0.75rem;
  font-weight: 600;
  font-style: italic;
  color: var(--text-muted);
}

.bookmarklet-drag-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  cursor: grab;
}

.bookmarklet-drag-link:active {
  cursor: grabbing;
}

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

.bm-field {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 320px;
}

.bm-field label {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
}

.bm-field input {
  width: 100%;
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #111111;
}

.bookmarklet-output-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.bookmarklet-output-row input {
  flex: 1;
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  padding: 6px 9px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.76rem;
  color: #111111;
}

/* Carte de Téléportation (5x6) */
.map-container {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #d6d1c2;
  border: 2px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.map-bg-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  pointer-events: none;
}

.map-grid-overlay {
  position: absolute;
  inset: 1.8%;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(6, 1fr);
}

.map-cell {
  position: relative;
  border: 1px solid transparent;
  background: transparent;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.1s ease, border-color 0.1s ease, box-shadow 0.1s ease;
}

.map-cell:hover {
  border-color: #c82018;
  background: rgba(200, 32, 24, 0.18);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
  z-index: 2;
}

.map-cell.active {
  background: rgba(200, 32, 24, 0.14);
}

.map-cell-fallback-id {
  font-size: 0.68rem;
  font-weight: 800;
  color: #111111;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.map-x-marker {
  width: 82%;
  height: 82%;
  pointer-events: none;
  filter: drop-shadow(1px 1px 0 #111111);
}

/* Pavé de déplacement rapide sous la carte */
.move-pad {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1.5px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.move-coords-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.move-coords-row label {
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--text);
  flex-shrink: 0;
}

.move-coords-row input {
  flex: 1;
  min-width: 0;
  width: auto;
  height: 32px;
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  padding: 0 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 700;
  color: #111111;
}

.move-coords-row button {
  flex-shrink: 0;
  height: 32px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.move-shortcuts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  width: 100%;
}

.move-shortcuts-row button {
  width: 100%;
  height: 30px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.move-pad button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 1100px) {
  .workspace-grid {
    grid-template-columns: 250px 1fr;
    grid-template-rows: 440px auto;
  }

  .players-panel {
    grid-column: 1;
    grid-row: 1;
  }

  .chat-panel {
    grid-column: 2;
    grid-row: 1;
  }

  .map-panel {
    grid-column: 1 / span 2;
    grid-row: 2;
    max-width: 340px;
  }

  .appearance-layout {
    grid-template-columns: 1fr;
  }

  .appearance-parts-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .workspace-grid {
    grid-template-columns: 1fr;
    grid-template-rows: 260px 440px auto;
  }

  .players-panel {
    grid-column: 1;
    grid-row: 1;
  }

  .chat-panel {
    grid-column: 1;
    grid-row: 2;
  }

  .map-panel {
    grid-column: 1;
    grid-row: 3;
    max-width: none;
  }
}
