/* ===== VIEWPORT META TAG ===== */
/* Assurer que le viewport est correctement configuré pour mobile */
@viewport {
  width: device-width;
  initial-scale: 1.0;
  maximum-scale: 1.0;
  user-scalable: 0;
}

/* ===== PAGE D'ACCUEIL ===== */
.homePage {
  margin: 0;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at center, #6a5acd, #4b0082);
  font-family: Arial;
  color: white;
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* ===== RESPONSIVE DESIGN ===== */
/* Mobile */
@media (max-width: 768px) {
  .homePage {
    padding: 20px;
  }
  
  .magik-title {
    font-size: 24px !important;
    margin: 10px 0;
  }
  
  .homeContainer p {
    font-size: 14px;
    margin: 10px 0;
  }
  
  .enterBtn {
    padding: 12px 24px;
    font-size: 16px;
    margin: 15px 0;
  }
}

/* Très petits écrans */
@media (max-width: 480px) {
  .magik-title {
    font-size: 20px !important;
  }
  
  .homeContainer p {
    font-size: 12px;
  }
  
  .enterBtn {
    padding: 10px 20px;
    font-size: 14px;
  }
}

/* Sparkle cursor effect */
.sparkle {
  position: fixed;
  pointer-events: none;
  width: 4px;
  height: 4px;
  background: #ffeb3b;
  border-radius: 50%;
  animation: sparkleFall 0.2s ease-out forwards;
  z-index: 9999;
}

@keyframes sparkleFall {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(var(--dx), var(--dy)) scale(0);
    opacity: 0;
  }
}

/* Mascotte magique */
.mascotte {
  position: absolute;
  width: 80px;
  height: 80px;
  z-index: 500;
  pointer-events: none;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-15px);
  }
}

/* Étoiles de la mascotte */
.mascotte-sparkle {
  position: absolute;
  width: 3px;
  height: 3px;
  background: #FFD700;
  border-radius: 50%;
  pointer-events: none;
  animation: sparkleFall 2s ease-out forwards;
  z-index: 499;
}

/* Texte MagiK */
.magik-text {
  position: fixed;
  font-family: 'Minecraftia', 'Courier New', monospace;
  font-size: 32px;
  font-weight: bold;
  color: white;
  text-shadow: 2px 2px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
  pointer-events: none;
  z-index: 501;
  animation: magikGlow 2s ease-out forwards;
}

@keyframes magikGlow {
  0% {
    opacity: 0;
    transform: scale(0.5);
    filter: brightness(0.5);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
    filter: brightness(1.5) drop-shadow(0 0 20px rgba(255, 215, 0, 0.8));
  }
  100% {
    opacity: 0;
    transform: scale(0.8);
    filter: brightness(0.3);
  }
}

.homeContainer {
  animation: fadeIn 1.2s ease;
}

/* MagiK Studio title with Minecraft font */
.magik-title {
  font-family: 'Minecraftia', 'Courier New', monospace;
  font-size: 48px;
  font-weight: bold;
  color: white;
  text-shadow: 2px 2px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
  margin: 0;
  letter-spacing: 2px;
}

.enterBtn {
  display: inline-block;
  margin-top: 20px;
  padding: 14px 28px;
  font-size: 18px;
  font-weight: bold;
  color: white;
  background: linear-gradient(45deg, #4a00e0, #8e2de2);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(142, 45, 226, 0.4);
}

/* ===== RESPONSIVE SHOP PAGE ===== */
/* Mobile */
@media (max-width: 768px) {
  .shop-container {
    padding: 10px;
    padding-bottom: 80px; /* Espace pour le bouton chat */
  }
  
  .banner {
    padding: 15px;
    margin: 10px 0;
    position: relative;
    z-index: 10;
    background: linear-gradient(45deg, #4a00e0, #8e2de2);
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(142, 45, 226, 0.4);
  }
  
  .banner h2 {
    font-size: 24px;
    color: white;
    text-shadow: 2px 2px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
  }
  
  .products-text {
    font-size: 28px;
    margin: 80px 0 15px 0;
  }
  
  .enderman-section {
    padding: 15px;
    margin: 10px 0;
  }
  
  .enderman-head {
    width: 80px;
    height: 80px;
    margin: 5px;
  }
  
  .enderman-label {
    font-size: 10px;
  }
  
  .team-section {
    padding: 15px;
  }
  
  .team-title h2 {
    font-size: 24px;
  }
  
  .team-members {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
  }
  
  .member-card {
    padding: 10px;
  }
  
  .member-avatar {
    width: 60px;
    height: 60px;
  }
  
  .member-name {
    font-size: 12px;
  }
  
  .member-role {
    font-size: 10px;
  }
  
  /* Chat Beta responsive - CORRIGÉ */
  .chat-beta-btn {
    bottom: 20px !important;
    right: 20px !important;
    padding: 12px 16px !important;
    font-size: 12px !important;
    z-index: 1000 !important;
    position: fixed !important;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }
  
  .chat-beta-btn.hidden {
    opacity: 0;
    visibility: hidden;
  }
  
  .chat-window {
    bottom: 80px !important;
    right: 20px !important;
    width: 350px !important;
    height: 60vh !important;
    max-height: 400px !important;
    z-index: 999 !important;
    position: fixed !important;
    transform: none !important;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }
  
  .chat-window.visible {
    opacity: 1;
    visibility: visible;
  }
  
  .chat-user-settings {
    padding: 8px;
  }
  
  .current-username {
    font-size: 9px;
  }
  
  .username-change input {
    font-size: 9px;
    padding: 3px 6px;
  }
  
  .username-change button {
    font-size: 9px;
    padding: 3px 8px;
  }
  
  .chat-messages {
    padding: 10px;
  }
  
  .chat-message {
    padding: 6px 10px;
  }
  
  .chat-message .username {
    font-size: 9px;
  }
  
  .chat-message .text {
    font-size: 11px;
  }
  
  .chat-message .time {
    font-size: 7px;
  }
  
  .chat-input {
    padding: 8px;
  }
  
  .chat-input input {
    font-size: 11px;
    padding: 6px 10px;
  }
  
  .chat-input button {
    font-size: 11px;
    padding: 6px 12px;
  }
  
  .chat-close {
    width: 28px;
    height: 28px;
    font-size: 14px;
    padding: 4px 8px;
  }
  
  .chat-close:hover {
    transform: scale(1.1) rotate(90deg);
  }
}

/* Très petits écrans */
@media (max-width: 480px) {
  .shop-container {
    padding-bottom: 100px; /* Encore plus d'espace pour les petits écrans */
  }
  
  .banner {
    padding: 12px;
    margin: 8px 0;
  }
  
  .banner h2 {
    font-size: 20px;
  }
  
  .products-text {
    font-size: 24px;
    margin: 60px 0 10px 0;
  }
  
  .enderman-head {
    width: 60px;
    height: 60px;
  }
  
  .team-title h2 {
    font-size: 20px;
  }
  
  .team-members {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
  }
  
  .member-avatar {
    width: 50px;
    height: 50px;
  }
  
  /* Chat ultra-mobile - CORRIGÉ */
  .chat-beta-btn {
    bottom: 15px !important;
    right: 15px !important;
    padding: 10px 14px !important;
    font-size: 11px !important;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }
  
  .chat-beta-btn.hidden {
    opacity: 0;
    visibility: hidden;
  }
  
  .chat-window {
    bottom: 70px !important;
    right: 15px !important;
    width: 90vw !important;
    max-width: 350px !important;
    height: 65vh !important;
    max-height: 350px !important;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }
  
  .chat-window.visible {
    opacity: 1;
    visibility: visible;
  }
  
  .chat-user-settings {
    padding: 6px;
  }
  
  .current-username {
    font-size: 8px;
  }
  
  .username-change input {
    font-size: 8px;
    padding: 2px 4px;
  }
  
  .username-change button {
    font-size: 8px;
    padding: 2px 6px;
  }
  
  .chat-messages {
    padding: 8px;
  }
  
  .chat-message {
    padding: 4px 8px;
  }
  
  .chat-message .username {
    font-size: 8px;
  }
  
  .chat-message .text {
    font-size: 10px;
  }
  
  .chat-message .time {
    font-size: 6px;
  }
  
  .chat-input {
    padding: 6px;
  }
  
  .chat-input input {
    font-size: 10px;
    padding: 4px 8px;
  }
  
  .chat-input button {
    font-size: 10px;
    padding: 4px 10px;
  }
  
  .chat-close {
    width: 24px;
    height: 24px;
    font-size: 12px;
    padding: 2px 6px;
  }
}

/* Texte Products */
.products-text {
  font-family: 'Minecraftia', 'Courier New', monospace;
  font-size: 36px;
  font-weight: bold;
  color: white;
  font-style: italic;
  text-align: center;
  margin: 120px 0 20px 0;
  text-shadow: 2px 2px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
  animation: breathe 3s ease-in-out infinite;
  z-index: 502;
  position: relative;
}

/* Monter les têtes enderman */
.enderman-section {
  margin-top: -40px;
}

@keyframes breathe {
  0%, 100% {
    transform: scale(1);
    text-shadow: 2px 2px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000, 0 0 20px rgba(255, 255, 255, 0.5);
  }
  50% {
    transform: scale(1.1);
    text-shadow: 2px 2px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000, 0 0 30px rgba(255, 255, 255, 0.8);
  }
}

/* Suite du CSS existant */
.enterBtn {
  background: #7b3ff2;
  color: white;
  text-decoration: none;
  font-size: 18px;
  border-radius: 8px;
  transition: 0.3s;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 15px rgba(255,255,255,0.4), 0 0 30px rgba(255,255,255,0.2);
  animation: whiteAura 3s ease-in-out infinite;
}

.enterBtn:hover {
  transform: scale(1.1);
  background: #9d5bff;
  box-shadow: 0 0 25px rgba(255,255,255,0.6), 0 0 50px rgba(255,255,255,0.3);
}

.platforms-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 32px;
}

.platforms-title {
  color: rgba(255,255,255,0.45);
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  font-family: 'Courier New', monospace;
}

.platforms-icons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
}

.platform-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  opacity: 0.55;
  transition: opacity 0.2s, transform 0.2s;
}

.platform-icon:hover {
  opacity: 1;
  transform: translateY(-3px);
}

.platform-icon svg {
  width: 28px;
  height: 28px;
  fill: white;
}

.platform-icon span {
  font-size: 8px;
  color: rgba(255,255,255,0.55);
  font-family: 'Courier New', monospace;
  letter-spacing: 1px;
}

@keyframes whiteAura {
  0% { 
    box-shadow: 0 0 10px rgba(255,255,255,0.2), 0 0 20px rgba(255,255,255,0.1);
  }
  50% { 
    box-shadow: 0 0 25px rgba(255,255,255,0.6), 0 0 50px rgba(255,255,255,0.3);
  }
  100% { 
    box-shadow: 0 0 10px rgba(255,255,255,0.2), 0 0 20px rgba(255,255,255,0.1);
  }
}

@keyframes fadeIn {
  from {opacity:0; transform: translateY(20px);}
  to {opacity:1; transform: translateY(0);}
}

/* ===== PAGE EDITEUR ===== */
.editorPage {
  background: #1e2530;
  margin: 0;
  font-family: Arial;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

#editorTabBar {
  display: flex;
  gap: 2px;
  background: #12161d;
  padding: 8px 8px 0 8px;
  flex-shrink: 0;
  z-index: 20;
}

.editor-tab-btn {
  background: #2a2f3a;
  color: rgba(255, 255, 255, 0.6);
  border-radius: 6px 6px 0 0;
  padding: 10px 22px;
  font-size: 13px;
  font-weight: bold;
}

.editor-tab-btn:hover {
  background: #3a3f4a;
  transform: none;
}

.editor-tab-btn.active {
  background: #1e2530;
  color: #fff;
}

.editor-tab-content {
  display: none;
  flex: 1;
  overflow: hidden;
}

.editor-tab-content.active {
  display: flex;
}

/* 3 colonnes (outils / canvas+aperçu / panneau position-liste) : si ça ne tient pas en largeur,
   on veut un scroll horizontal plutôt que de clipper la colonne de droite (overflow:hidden
   ci-dessus la ferait disparaître complètement au lieu de juste la pousser hors champ). */
#hdEditorTab.active {
  overflow-x: auto;
}

#leftPanel {
  width: 40%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#tools {
  margin-bottom: 10px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

button {
  padding: 6px 10px;
  cursor: pointer;
  border-radius: 4px;
  border: none;
  background: #7b3ff2;
  color: white;
  transition: 0.2s;
}

button:hover {
  background: #9d5bff;
  transform: scale(1.05);
}

button:disabled {
  background: #666;
  color: #999;
  cursor: not-allowed;
  opacity: 0.5;
}

#canvasWrapper {
  overflow: hidden;
  position: relative;
  width: min(640px, 90%);
  aspect-ratio: 2 / 1;
  border: 2px solid white;
  background: #00ff00;
  cursor: crosshair;
}

canvas {
  image-rendering: pixelated;
  width: 100%;
  height: 100%;
  display: block;
  transform-origin: 0 0;
}

#viewer {
  width: 60%;
  position: relative;
}

#animationControls {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  z-index: 10;
}

#animationControls button {
  padding: 6px 10px;
  font-size: 12px;
  min-width: 80px;
}

#cameraControls {
  position: absolute;
  bottom: 20px;
  left: 42%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  z-index: 10;
}

#camMiddle {
  display: flex;
  gap: 4px;
}

#cameraControls button {
  width: 38px;
  height: 38px;
  padding: 0;
  font-size: 16px;
  background: rgba(60, 60, 80, 0.85);
  border-radius: 6px;
  user-select: none;
  touch-action: none;
  -webkit-user-select: none;
}

#cameraControls button:hover {
  background: #9d5bff;
  transform: scale(1.05);
}

#zoomControls {
  position: absolute;
  bottom: 20px;
  right: 20px;
  display: flex;
  gap: 10px;
}

#zoomControls button {
  padding: 8px 14px;
  font-size: 14px;
  background: #444;
}

/* ===== HD CAPE EDITOR (positionnement 2D, sans dessin ni aperçu 3D) ===== */
#hdLeftPanel {
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 24px;
  overflow: auto;
  padding: 20px;
}

#hdMainColumn {
  display: flex;
  flex-direction: column;
  align-items: center;
}

#hdPreviewColumn {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.hd-section-title {
  color: rgba(255, 255, 255, 0.7);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 1px;
  font-weight: bold;
  margin: 8px 0;
}

#hdPreviewWrapper {
  width: 150px;
  height: 240px;
  border: 2px solid white;
  background: #000;
}

#hdPreviewCanvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
}

#hdBgSwatches {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.hd-bg-swatch {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  cursor: pointer;
}

.hd-bg-swatch:hover {
  border-color: #fff;
  transform: scale(1.1);
}

#hdCanvasWrapper {
  width: 512px;
  height: 512px;
  max-width: 90vw;
  max-height: 70vh;
  aspect-ratio: 1 / 1;
  border: 2px solid white;
  background:
    linear-gradient(45deg, #444 25%, transparent 25%, transparent 75%, #444 75%, #444),
    linear-gradient(45deg, #444 25%, #333 25%, #333 75%, #444 75%, #444);
  background-size: 20px 20px;
  background-position: 0 0, 10px 10px;
}

#hdCanvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  cursor: default;
}

#hdSidePanel {
  width: 280px;
  flex-shrink: 0;
  background: #12161d;
  padding: 20px 16px;
  overflow-y: auto;
  color: white;
  font-size: 13px;
}

#hdToolsColumn {
  width: 200px;
  flex-shrink: 0;
  background: #12161d;
  padding: 20px 16px;
  overflow-y: auto;
  color: white;
  font-size: 13px;
}

#hdCoordLabel {
  margin-bottom: 20px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.85);
  word-break: break-word;
}

.hd-nudge-group {
  margin-bottom: 20px;
}

.hd-nudge-title {
  font-weight: bold;
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.7);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 1px;
}

.hd-nudge-row {
  display: flex;
  gap: 6px;
}

.hd-nudge-row button {
  flex: 1;
  padding: 8px 0;
}

#hdLegend {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: rgba(255, 255, 255, 0.7);
  align-self: flex-start;
}

.hd-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: middle;
}

.hd-swatch-green { background: #2ecc40; }
.hd-swatch-blue { background: #39cccc; }
.hd-swatch-orange { background: #ff851b; }
.hd-swatch-cyan { background: #00ffff; }
.hd-swatch-rotate { background: #0074d9; }

#hdImportedList {
  width: 100%;
  background: #2a2f3a;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  margin-bottom: 16px;
  font-size: 12px;
}

#hdImportedList option {
  padding: 4px 6px;
}

.hd-full-btn {
  display: block;
  width: 100%;
  margin-bottom: 6px;
}

.hd-status {
  color: rgba(255, 255, 255, 0.6);
  font-size: 11px;
  margin-bottom: 10px;
  word-break: break-word;
}

.hd-danger {
  background: #ff4136;
}

.hd-danger:hover {
  background: #ff6a5f;
}

#zoomControls button:hover {
  background: #9d5bff;
}

