* { box-sizing: border-box; }

body {
  font-family: system-ui, sans-serif;
  background: #0b1120;
  color: #f9fafb;
  display: flex;
  flex-direction: column;
  height: 100vh;
  margin: 0;
  padding: 8px 12px;
  gap: 8px;
}

.top-bar-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-start;
}
.top-bar-left h1 {
  margin: 0;
  font-size: 18px;
  white-space: nowrap;
}
.top-bar-left button {
  font-size: 13px;
  padding: 5px 10px;
}

.top-bar-right {
  margin-left: auto;
}
.premium-btn {
  font-size: 13px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid #fbbf24;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #111827;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-start;
  font-size: 13px;
}
.controls input[type="file"] {
  font-size: 13px;
}

.shape-palette {
  display: flex;
  justify-content: flex-start;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 2px;
  margin-bottom: 4px;
}
.shape-item {
  width: 48px;
  height: 48px;
  border: 2px solid #4b5563;
  border-radius: 6px;
  background: #020617;
  cursor: pointer;
}
.shape-item.selected {
  border-color: #f59e0b;
  box-shadow: 0 0 0 1px #facc15;
}
.shape-item canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.main-area {
  flex: 1;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: stretch;
  gap: 12px;
  min-height: 0;
}
.canvas-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 0;
  min-height: 0;
  font-size: 12px;
}
.canvas-title {
  color: #e5e7eb;
  margin-bottom: 2px;
  text-align: center;
  font-size: 12px;
}
.canvas-wrapper {
  position: relative;
  width: 100%;
  max-width: 260px;
  margin: 0 auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 0;
}
canvas.main-canvas {
  border: 1px solid #4b5563;
  background: #000000;
  width: 100%;
  aspect-ratio: 1 / 1;
  touch-action: none;
}
#canvasRight { cursor: grab; }
#canvasRight.dragging { cursor: grabbing; }

.zoom-wrapper {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
  font-size: 11px;
  color: #d1d5db;
}
.zoom-wrapper input[type="range"] {
  width: 120px;
}

#posInfo {
  text-align: center;
  font-size: 11px;
  color: #d1d5db;
  margin-top: 2px;
}
#posInfo input {
  width: 60px;
  font-size: 11px;
  padding: 1px 3px;
  border-radius: 3px;
  border: 1px solid #4b5563;
  background: #111827;
  color: #f9fafb;
}

@media (max-width: 900px) {
  .main-area { flex-direction: column; }
  .canvas-wrapper { max-width: 260px; }
}

/* Affichage vertical de la palette de formes sur petits écrans (iPhone, etc.) */
@media (max-width: 600px) {
  .shape-palette {
    flex-direction: column;
    align-items: flex-start;
  }

  .shape-item {
    width: 100%;
    max-width: 260px;
  }

  .shape-item canvas {
    width: 100%;
    height: auto;
  }
}
