.game-container { max-width: 1200px; margin: 24px auto; padding: 0 20px; }

body { text-transform: uppercase; }

.hidden { display: none !important; }

.level-buttons {
  display: flex;
  gap: 16px;
  margin: 20px 0;
}

.btn-level {
  flex: 1;
  padding: 20px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  cursor: pointer;
  transition: all 120ms ease;
  text-align: center;
}

.btn-level:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.level-title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 8px;
}

.level-desc {
  font-size: 14px;
  opacity: 0.9;
}

.game-area {
  display: flex;
  gap: 20px;
  min-height: 500px;
}

.pieces-area {
  flex: 0 0 200px;
  background: #f3f4f6;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.canvas-area {
  flex: 1;
  background: #ffffff;
  border: 2px dashed #d1d5db;
  border-radius: 12px;
  position: relative;
  min-height: 900px;
  min-width: 650px;
}

.piece {
  cursor: move;
  transition: all 120ms ease;
  position: relative;
}

.piece:not(.canvas-piece) svg {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
}

.piece:hover {
  transform: scale(1.05);
}

.piece.selected {
  transform: scale(1.1);
  box-shadow: 0 0 0 3px #3b82f6;
}

.piece.used {
  opacity: 0.3;
  pointer-events: none;
}

.piece-svg {
  width: 100%;
  height: 100%;
}

/* Piezas del tangram con colores correctos */
.square-red {
  fill: #ef4444;
}

.triangle-green {
  fill: #22c55e;
}

.triangle-yellow {
  fill: #eab308;
}

.square-orange {
  fill: #f97316;
}

.parallelogram-blue {
  fill: #1e40af;
}

.canvas-piece {
  position: absolute;
  cursor: move;
  z-index: 10;
  transform-origin: center;
  transition: cursor 0.1s ease;
}

.canvas-piece:hover {
  filter: brightness(1.1);
}

.canvas-piece:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.canvas-piece.rotating {
  cursor: grab;
}

.reference-image {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.3;
  pointer-events: none;
  max-width: 80%;
  max-height: 80%;
}

.reference-card {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 120px;
  height: 120px;
  background: #ffffff;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  padding: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.reference-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.row-actions { 
  display: flex; 
  justify-content: space-between; 
  margin-top: 16px; 
  gap: 12px;
}

.btn-next { 
  padding: 12px 16px; 
  border-radius: 999px; 
  background: linear-gradient(180deg, #22c55e, #16a34a); 
  color: #052e16; 
  font-weight: 800; 
  border: none; 
  box-shadow: 0 10px 20px rgba(34,197,94,0.35); 
  cursor: pointer;
}

.btn-back { 
  padding: 12px 16px; 
  border-radius: 999px; 
  background: linear-gradient(180deg, #6b7280, #4b5563); 
  color: white; 
  font-weight: 800; 
  border: none; 
  box-shadow: 0 10px 20px rgba(107,114,128,0.35); 
  cursor: pointer;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(34,197,94,0.15);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.overlay.show { display: flex; animation: pop 300ms ease-out; }
.overlay .burst { font-size: 72px; background: #22c55e; color: white; padding: 20px 28px; border-radius: 16px; box-shadow: 0 20px 60px rgba(34,197,94,0.4); }

.rotate-overlay { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; text-align: center; padding: 24px; background: #0f172a; color: #fff; z-index: 60; }
.rotate-overlay .card { background: #111827; border: 1px solid rgba(255,255,255,0.12); padding: 16px 20px; border-radius: 14px; }
@media (orientation: portrait) and (max-width: 900px) {
  .rotate-overlay { display: flex; }
}

@keyframes pop {
  0% { transform: scale(0.9); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.btn-flip {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: transform 0.2s;
}

.btn-flip:hover {
  transform: scale(1.05);
}

.btn-save {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: transform 0.2s;
}

.btn-save:hover {
  transform: scale(1.05);
}
